All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.apicurio.datamodels.deref.InternalRefResolverVisitor Maven / Gradle / Ivy

The newest version!
package io.apicurio.datamodels.deref;

import io.apicurio.datamodels.models.Node;
import io.apicurio.datamodels.models.Referenceable;

/**
 * Simple visitor used to mark internal references as "resolved".
 * @author [email protected]
 */
public class InternalRefResolverVisitor extends AllReferenceableNodeVisitor {

    @Override
    protected void visitReferenceableNode(Referenceable refNode) {
        String ref = refNode.get$ref();
        // Internal refs are marked as resolved
        if (ref.startsWith("#/")) {
            Node node = (Node) refNode;
            node.setNodeAttribute(DereferenceConstants.KEY_RESOLUTION, DereferenceConstants.VALUE_RESOLVED);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy