use of graphql.language.NodeTraverser in project graphql-java by graphql-java.
the class QueryTraversal method visitImpl.
private void visitImpl(FieldVisitor visitFieldCallback, SelectionSet selectionSet, GraphQLCompositeType type, boolean preOrder) {
Map<Class<?>, Object> rootVars = new LinkedHashMap<>();
rootVars.put(QueryTraversalContext.class, new QueryTraversalContext(type, null));
FieldVisitor noOp = notUsed -> {
};
FieldVisitor preOrderCallback = preOrder ? visitFieldCallback : noOp;
FieldVisitor postOrderCallback = !preOrder ? visitFieldCallback : noOp;
NodeTraverser nodeTraverser = new NodeTraverser(rootVars, this::childrenOf);
nodeTraverser.depthFirst(new NodeVisitorImpl(preOrderCallback, postOrderCallback), selectionSet.getSelections());
}
Aggregations