com.github.fge.jsonschema.core.tree
Class InlineSchemaTree

java.lang.Object
  extended by com.github.fge.jsonschema.core.tree.BaseSchemaTree
      extended by com.github.fge.jsonschema.core.tree.InlineSchemaTree
All Implemented Interfaces:
SchemaTree, SimpleTree, AsJson

@Immutable
@ParametersAreNonnullByDefault
public final class InlineSchemaTree
extends BaseSchemaTree

A SchemaTree using inline dereferencing

In inline dereferencing, implementations are expected to trust that the schema is the referrent document for all contexts declared by id. For instance, with this schema:

     {
         "id": "x;//y/z",
         "sub": {
             "id": "t"
         }
     }
 

JSON Reference x://y/t# is this JSON document at JSON Pointer /sub.


Field Summary
 
Fields inherited from class com.github.fge.jsonschema.core.tree.BaseSchemaTree
baseNode, key, pointer
 
Constructor Summary
InlineSchemaTree(JsonNode baseNode)
          Deprecated. use InlineSchemaTree(SchemaKey, JsonNode) instead
InlineSchemaTree(JsonRef loadingRef, JsonNode baseNode)
          Deprecated. use InlineSchemaTree(SchemaKey, JsonNode) instead
InlineSchemaTree(SchemaKey key, JsonNode baseNode)
          Main constructor
 
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
 JsonPointer matchingPointer(JsonRef ref)
          Return a matching pointer in this tree for a fully resolved reference
 SchemaTree setPointer(JsonPointer pointer)
          Relocate the tree with an absolute pointer
 
Methods inherited from class com.github.fge.jsonschema.core.tree.BaseSchemaTree
asJson, equals, getBaseNode, getContext, getDollarSchema, getId, getLoadingRef, getNode, getPointer, hashCode, idFromNode, resolve, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InlineSchemaTree

public InlineSchemaTree(SchemaKey key,
                        JsonNode baseNode)
Main constructor

Parameters:
key - the schema key
baseNode - the base node

InlineSchemaTree

@Deprecated
public InlineSchemaTree(JsonNode baseNode)
Deprecated. use InlineSchemaTree(SchemaKey, JsonNode) instead

Alternate constructor

Parameters:
baseNode - the base node

InlineSchemaTree

@Deprecated
public InlineSchemaTree(JsonRef loadingRef,
                                   JsonNode baseNode)
Deprecated. use InlineSchemaTree(SchemaKey, JsonNode) instead

Alternate constructor

Parameters:
loadingRef - the loading ref
baseNode - the base node
Method Detail

append

public SchemaTree append(JsonPointer pointer)
Description copied from interface: SchemaTree
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

public SchemaTree setPointer(JsonPointer pointer)
Description copied from interface: SchemaTree
Relocate the tree with an absolute pointer

Parameters:
pointer - the pointer
Returns:
a new tree

containsRef

public boolean containsRef(JsonRef ref)
Description copied from interface: SchemaTree
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:
SchemaTree.resolve(JsonRef)

matchingPointer

public JsonPointer matchingPointer(JsonRef ref)
Description copied from interface: SchemaTree
Return a matching pointer in this tree for a fully resolved reference

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

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