use of graphql.language.FragmentSpread in project graphql-java by graphql-java.
the class NoFragmentCycles method gatherSpreads.
private List<FragmentSpread> gatherSpreads(FragmentDefinition fragmentDefinition) {
final List<FragmentSpread> fragmentSpreads = new ArrayList<>();
DocumentVisitor visitor = new DocumentVisitor() {
@Override
public void enter(Node node, List<Node> path) {
if (node instanceof FragmentSpread) {
fragmentSpreads.add((FragmentSpread) node);
}
}
@Override
public void leave(Node node, List<Node> path) {
}
};
new LanguageTraversal().traverse(fragmentDefinition, visitor);
return fragmentSpreads;
}
use of graphql.language.FragmentSpread in project graphql-java by graphql-java.
the class GraphqlAntlrToLanguage method visitFragmentSpread.
@Override
public Void visitFragmentSpread(GraphqlParser.FragmentSpreadContext ctx) {
FragmentSpread fragmentSpread = new FragmentSpread(ctx.fragmentName().getText());
newNode(fragmentSpread, ctx);
((SelectionSet) getFromContextStack(ContextProperty.SelectionSet)).getSelections().add(fragmentSpread);
addContextProperty(ContextProperty.FragmentSpread, fragmentSpread);
super.visitFragmentSpread(ctx);
popContext();
return null;
}
Aggregations