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

java.lang.Object
  extended by com.github.fge.jsonschema.core.tree.BaseJsonTree
All Implemented Interfaces:
JsonTree, SimpleTree, AsJson
Direct Known Subclasses:
SimpleJsonTree

public abstract class BaseJsonTree
extends Object
implements JsonTree

Base implementation of a JsonTree


Field Summary
protected  JsonNode baseNode
          The initial node
protected static JsonNodeFactory FACTORY
           
protected  JsonPointer pointer
          The current JSON Pointer into the node.
 
Constructor Summary
protected BaseJsonTree(JsonNode baseNode)
          Protected constructor
protected BaseJsonTree(JsonNode baseNode, JsonPointer pointer)
          Main constructor
 
Method Summary
 JsonNode getBaseNode()
          Return the node this tree was created with
 JsonNode getNode()
          Get the node at the current path
 JsonPointer getPointer()
          Get the current path into the document
abstract  String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.github.fge.jsonschema.core.tree.JsonTree
append
 
Methods inherited from interface com.github.fge.jsonschema.core.util.AsJson
asJson
 

Field Detail

FACTORY

protected static final JsonNodeFactory FACTORY

baseNode

protected final JsonNode baseNode
The initial node


pointer

protected final JsonPointer pointer
The current JSON Pointer into the node. Starts empty.

Constructor Detail

BaseJsonTree

protected BaseJsonTree(JsonNode baseNode)
Protected constructor

This is equivalent to calling BaseJsonTree(JsonNode, JsonPointer) with an empty pointer.

Parameters:
baseNode - the base node

BaseJsonTree

protected BaseJsonTree(JsonNode baseNode,
                       JsonPointer pointer)
Main constructor

Parameters:
baseNode - the base node
pointer - the pointer into the base node
Method Detail

getBaseNode

public final JsonNode getBaseNode()
Description copied from interface: SimpleTree
Return the node this tree was created with

Note: in current Jackson versions, this node is unfortunately mutable, so be careful...

Specified by:
getBaseNode in interface SimpleTree
Returns:
the node

getPointer

public final JsonPointer getPointer()
Description copied from interface: SimpleTree
Get the current path into the document

Specified by:
getPointer in interface SimpleTree
Returns:
the path as a JSON Pointer

getNode

public final JsonNode getNode()
Description copied from interface: SimpleTree
Get the node at the current path

Specified by:
getNode in interface SimpleTree
Returns:
the matching node (a MissingNode if there is no matching node at that pointer)

toString

public abstract String toString()
Overrides:
toString in class Object