Package graphql.language
Class AstTransformer
- java.lang.Object
-
- graphql.language.AstTransformer
-
@PublicApi public class AstTransformer extends java.lang.Object
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 Constructor Description AstTransformer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
transform(Node root, NodeVisitor nodeVisitor)
Transforms the input tree using the Visitor Pattern.Node
transform(Node root, NodeVisitor nodeVisitor, java.util.Map<java.lang.Class<?>,java.lang.Object> rootVars)
Transforms the input tree using the Visitor Pattern.Node
transformParallel(Node root, NodeVisitor nodeVisitor)
Node
transformParallel(Node root, NodeVisitor nodeVisitor, java.util.concurrent.ForkJoinPool forkJoinPool)
-
-
-
Method Detail
-
transform
public Node transform(Node root, NodeVisitor nodeVisitor)
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
public Node transform(Node root, NodeVisitor nodeVisitor, java.util.Map<java.lang.Class<?>,java.lang.Object> rootVars)
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
public Node transformParallel(Node root, NodeVisitor nodeVisitor)
-
transformParallel
public Node transformParallel(Node root, NodeVisitor nodeVisitor, java.util.concurrent.ForkJoinPool forkJoinPool)
-
-