T
- type of tree node@PublicApi public interface TraverserContext<T>
setAccumulate(Object)
There is always a "fake" root context with null node, null parent, null position. See isRootContext()
Modifier and Type | Interface and Description |
---|---|
static class |
TraverserContext.Phase |
Modifier and Type | Method and Description |
---|---|
void |
changeNode(T newNode)
Change the current node to the provided node.
|
void |
deleteNode()
Deletes the current node.
|
java.util.List<Breadcrumb<T>> |
getBreadcrumbs()
The exact location of this node inside the tree as a list of
Breadcrumb |
java.util.Map<java.lang.String,java.util.List<TraverserContext<T>>> |
getChildrenContexts()
In case of leave returns the children contexts, which have already been visited.
|
<U> U |
getCurrentAccumulate()
The current accumulate value used as "input" for the current step.
|
NodeLocation |
getLocation()
The location of the current node regarding to the parent node.
|
<U> U |
getNewAccumulate()
The new accumulate value, previously set by
setAccumulate(Object)
or getCurrentAccumulate() if setAccumulate(Object) not invoked. |
TraverserContext<T> |
getParentContext()
Returns parent context.
|
T |
getParentNode()
The parent node.
|
java.util.List<T> |
getParentNodes()
The list of parent nodes starting from the current parent.
|
TraverserContext.Phase |
getPhase() |
<U> U |
getSharedContextData()
Used to share something across all TraverserContext.
|
<S> S |
getVar(java.lang.Class<? super S> key)
Obtains a context local variable
|
<S> S |
getVarFromParents(java.lang.Class<? super S> key)
Searches for a context variable starting from the parent
up the hierarchy of contexts until the first variable is found.
|
boolean |
isChanged() |
boolean |
isDeleted() |
boolean |
isParallel()
If the traversing happens in parallel (multi threaded) or not.
|
boolean |
isRootContext()
Returns true for the root context, which doesn't have a node or a position.
|
boolean |
isVisited()
Informs that the current node has been already "visited"
|
T |
originalThisNode()
Returns the original, unchanged, not deleted Node.
|
void |
setAccumulate(java.lang.Object accumulate)
Sets the new accumulate value.
|
<S> TraverserContext<T> |
setVar(java.lang.Class<? super S> key,
S value)
Stores a variable in the context
|
T |
thisNode()
Returns current node being visited.
|
java.util.Set<T> |
visitedNodes()
Obtains all visited nodes and values received by the
TraverserVisitor.enter(graphql.util.TraverserContext)
method |
T thisNode()
changeNode(Object)
is called.
Throws Exception if the node is deleted.AssertException
- if the current node is deletedT originalThisNode()
void changeNode(T newNode)
newNode
- the new Nodevoid deleteNode()
boolean isDeleted()
deleteNode()
boolean isChanged()
changeNode(Object)
TraverserContext<T> getParentContext()
getParentContext()
links one could obtain
the current path as well as the variables getVar(java.lang.Class)
stored in every parent context.java.util.List<T> getParentNodes()
T getParentNode()
java.util.List<Breadcrumb<T>> getBreadcrumbs()
Breadcrumb
NodeLocation getLocation()
boolean isVisited()
true
if a node had been already visitedjava.util.Set<T> visitedNodes()
TraverserVisitor.enter(graphql.util.TraverserContext)
method<S> S getVar(java.lang.Class<? super S> key)
S
- type of the variablekey
- key to lookup the variable valuenull
<S> S getVarFromParents(java.lang.Class<? super S> key)
S
- type of the variablekey
- key to lookup the variable valuenull
<S> TraverserContext<T> setVar(java.lang.Class<? super S> key, S value)
S
- type of a varablekey
- key to create bindings for the variablevalue
- value of variablevoid setAccumulate(java.lang.Object accumulate)
getNewAccumulate()
accumulate
- to set<U> U getNewAccumulate()
setAccumulate(Object)
or getCurrentAccumulate()
if setAccumulate(Object)
not invoked.U
- and me<U> U getCurrentAccumulate()
U
- and me<U> U getSharedContextData()
U
- and meboolean isRootContext()
java.util.Map<java.lang.String,java.util.List<TraverserContext<T>>> getChildrenContexts()
TraverserContext.Phase getPhase()
boolean isParallel()