Package graphql.language
Class AstTransformer
java.lang.Object
graphql.language.AstTransformer
Allows for an easy way to "manipulate" the immutable Ast by changing specific nodes and getting back a new Ast
containing the changed nodes while everything else is the same.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiontransform
(Node root, NodeVisitor nodeVisitor) Transforms the input tree using the Visitor Pattern.Transforms the input tree using the Visitor Pattern.transformParallel
(Node root, NodeVisitor nodeVisitor) transformParallel
(Node root, NodeVisitor nodeVisitor, ForkJoinPool forkJoinPool)
-
Constructor Details
-
AstTransformer
public AstTransformer()
-
-
Method Details
-
transform
Transforms the input tree using the Visitor Pattern.- Parameters:
root
- the root node of the input tree.nodeVisitor
- the visitor which will transform the input tree.- Returns:
- the transformed tree.
-
transform
Transforms the input tree using the Visitor Pattern.- Parameters:
root
- the root node of the input tree.nodeVisitor
- the visitor which will transform the input tree.rootVars
- a context argument to pass information into the nodeVisitor. Pass a contextual object to your visitor by adding it to this map such that such that the key is the class of the object, and the value is the object itself. The object can be retrieved within the visitor by calling context.getVarFromParents().- Returns:
- the transformed tree.
-
transformParallel
-
transformParallel
-