com.github.fge.jsonschema.core.tree
Interface SchemaTree

All Superinterfaces:
AsJson, SimpleTree
All Known Implementing Classes:
BaseSchemaTree, CanonicalSchemaTree, InlineSchemaTree

public interface SchemaTree
extends SimpleTree

Tree representation of a JSON Schema

In addition to navigation capabilities and node retrieval, this tree returns URI context information and JSON Reference resolution.


Method Summary
 SchemaTree append(JsonPointer pointer)
          Relocate the tree relatively to the current tree's pointer
 boolean containsRef(JsonRef ref)
          Tell whether a JSON Reference is contained within this schema tree
 JsonRef getContext()
          Get the current resolution context
 JsonRef getDollarSchema()
          Return the metaschema URI for that schema (ie, $schema)
 long getId()
           
 JsonRef getLoadingRef()
          Get the loading URI for that schema
 JsonPointer matchingPointer(JsonRef ref)
          Return a matching pointer in this tree for a fully resolved reference
 JsonRef resolve(JsonRef other)
          Resolve a JSON Reference against the current resolution context
 SchemaTree setPointer(JsonPointer pointer)
          Relocate the tree with an absolute pointer
 
Methods inherited from interface com.github.fge.jsonschema.core.tree.SimpleTree
getBaseNode, getNode, getPointer
 
Methods inherited from interface com.github.fge.jsonschema.core.util.AsJson
asJson
 

Method Detail

append

SchemaTree append(JsonPointer pointer)
Relocate the tree relatively to the current tree's pointer

Parameters:
pointer - the pointer to append
Returns:
a new tree
See Also:
JsonPointer.append(JsonPointer)

setPointer

SchemaTree setPointer(JsonPointer pointer)
Relocate the tree with an absolute pointer

Parameters:
pointer - the pointer
Returns:
a new tree

resolve

JsonRef resolve(JsonRef other)
Resolve a JSON Reference against the current resolution context

Parameters:
other - the JSON Reference to resolve
Returns:
the resolved reference
See Also:
JsonRef.resolve(JsonRef)

containsRef

boolean containsRef(JsonRef ref)
Tell whether a JSON Reference is contained within this schema tree

This method will return true if the caller can attempt to retrieve the JSON value addressed by this reference from the schema tree directly.

Note that the reference must be fully resolved for this method to work.

Parameters:
ref - the target reference
Returns:
see description
See Also:
resolve(JsonRef)

matchingPointer

JsonPointer matchingPointer(JsonRef ref)
Return a matching pointer in this tree for a fully resolved reference

This must be called only when containsRef(JsonRef) returns true. Otherwise, its result is undefined.

Parameters:
ref - the reference
Returns:
the matching pointer, or null if not found

getId

long getId()

getDollarSchema

JsonRef getDollarSchema()
Return the metaschema URI for that schema (ie, $schema)

Note: it is required that if present, $schema be an absolute JSON Reference. If this keyword is not present and/or is malformed, an empty reference is returned.

Returns:
the contents of $schema as a JsonRef

getLoadingRef

JsonRef getLoadingRef()
Get the loading URI for that schema

Returns:
the loading URI as a JsonRef

getContext

JsonRef getContext()
Get the current resolution context

Returns:
the context as a JsonRef