public interface Node<T extends Node>
extends java.io.Serializable
Serializable
and hence it can be serialised and placed into a distributed cache. However we
are not aiming to provide long term compatibility and do not intend for you to place this serialised data into permanent storage,
with times frames that cross graphql-java versions. While we don't change things unnecessarily, we may inadvertently break
the serialised compatibility across versions.Modifier and Type | Method and Description |
---|---|
TraversalControl |
accept(TraverserContext<Node> context,
NodeVisitor visitor)
Double-dispatch entry point.
|
T |
deepCopy() |
java.util.List<Node> |
getChildren() |
java.util.List<Comment> |
getComments()
Nodes can have comments made on them, the following is one comment per line before a node.
|
SourceLocation |
getSourceLocation() |
boolean |
isEqualTo(Node node)
Compares just the content and not the children.
|
java.util.List<Node> getChildren()
SourceLocation getSourceLocation()
java.util.List<Comment> getComments()
boolean isEqualTo(Node node)
node
- the other node to compare toT deepCopy()
TraversalControl accept(TraverserContext<Node> context, NodeVisitor visitor)
instanceOf
check when decision based on the actual
type of Node is needed, which happens redundantly during traversing AST.
Additional advantage of this pattern is to decouple tree traversal mechanism
from the code that needs to be executed when traversal "visits" a particular Node
in the tree. This leads to a better code re-usability and maintainability.context
- TraverserContext bound to this Node objectvisitor
- Visitor instance that performs actual processing on the Nodes(s)