|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.github.fge.jackson.jsonpointer.TreePointer<T>
T
- the type of the tree@ThreadSafe public abstract class TreePointer<T extends com.fasterxml.jackson.core.TreeNode>
A pointer into a TreeNode
Note that all pointers are absolute: they start from the root of the tree. This is to mirror the behaviour of JSON Pointer proper.
The class does not decode a JSON Pointer representation itself; however it provides all the necessary methods for implementations to achieve this.
This class has two traversal methods: get(TreeNode)
and path(TreeNode)
. The difference between both is that path()
may
return another node than null
if the tree representation has such
a node. This is the case, for instance, for JsonNode
, which has a
MissingNode
.
At the core, this class is essentially a(n ordered!) List
of
TokenResolver
s (which is iterable via the class itself).
Note that this class' hashCode()
, equals(Object)
and
toString()
are final.
Field Summary | |
---|---|
protected static MessageBundle |
BUNDLE
|
protected List<TokenResolver<T>> |
tokenResolvers
The list of token resolvers |
Constructor Summary | |
---|---|
protected |
TreePointer(List<TokenResolver<T>> tokenResolvers)
Alternate constructor |
protected |
TreePointer(T missing,
List<TokenResolver<T>> tokenResolvers)
Main protected constructor |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
T |
get(T node)
Traverse a node and return the result |
int |
hashCode()
|
boolean |
isEmpty()
Tell whether this pointer is empty |
Iterator<TokenResolver<T>> |
iterator()
|
T |
path(T node)
Traverse a node and return the result |
protected static List<ReferenceToken> |
tokensFromInput(String input)
Decode an input into a list of reference tokens |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final MessageBundle BUNDLE
protected final List<TokenResolver<T extends com.fasterxml.jackson.core.TreeNode>> tokenResolvers
Constructor Detail |
---|
protected TreePointer(T missing, List<TokenResolver<T>> tokenResolvers)
This constructor makes an immutable copy of the list it receives as an argument.
missing
- the representation of a missing node (may be null)tokenResolvers
- the list of reference token resolversprotected TreePointer(List<TokenResolver<T>> tokenResolvers)
This is the same as calling TreePointer(TreeNode, List)
with
null
as the missing node.
tokenResolvers
- the list of token resolversMethod Detail |
---|
public final T get(T node)
Note that this method shortcuts: it stops at the first node it cannot traverse.
node
- the node to traverse
null
if not foundpublic final T path(T node)
This is like get(TreeNode)
, but it will return the missing
node if traversal fails.
node
- the node to traverse
TreePointer(TreeNode, List)
public final boolean isEmpty()
public final Iterator<TokenResolver<T>> iterator()
iterator
in interface Iterable<TokenResolver<T extends com.fasterxml.jackson.core.TreeNode>>
public final int hashCode()
hashCode
in class Object
public final boolean equals(Object obj)
equals
in class Object
public final String toString()
toString
in class Object
protected static List<ReferenceToken> tokensFromInput(String input) throws JsonPointerException
input
- the input
JsonPointerException
- input is not a valid JSON Pointer
NullPointerException
- input is null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |