protected SelectionSet createSelectionSet(GraphqlParser.SelectionSetContext ctx) { if (ctx == null) { return null; } SelectionSet.Builder builder = SelectionSet.newSelectionSet(); addCommonData(builder, ctx); List<Selection> selections = ctx.selection().stream().map(selectionContext -> { if (selectionContext.field() != null) { return createField(selectionContext.field()); } if (selectionContext.fragmentSpread() != null) { return createFragmentSpread(selectionContext.fragmentSpread()); } if (selectionContext.inlineFragment() != null) { return createInlineFragment(selectionContext.inlineFragment()); } return (Selection) Assert.assertShouldNeverHappen(); }).collect(toList()); builder.selections(selections); return builder.build(); }
protected SelectionSet createSelectionSet(GraphqlParser.SelectionSetContext ctx) { if (ctx == null) { return null; } SelectionSet.Builder builder = SelectionSet.newSelectionSet(); addCommonData(builder, ctx); List<Selection> selections = ctx.selection().stream().map(selectionContext -> { if (selectionContext.field() != null) { return createField(selectionContext.field()); } if (selectionContext.fragmentSpread() != null) { return createFragmentSpread(selectionContext.fragmentSpread()); } if (selectionContext.inlineFragment() != null) { return createInlineFragment(selectionContext.inlineFragment()); } return (Selection) Assert.assertShouldNeverHappen(); }).collect(toList()); builder.selections(selections); return builder.build(); }
public static Builder newSelectionSet(Collection<? extends Selection> selections) { return new Builder().selections(selections); }
private SelectionSet sortSelectionSet(SelectionSet selectionSet) { if (selectionSet == null) { return null; } List<Selection> selections = sort(selectionSet.getSelections(), comparingSelections()); return selectionSet.transform(builder -> builder.selections(selections)); }
@Override public SelectionSet withNewChildren(NodeChildrenContainer newChildren) { return transform(builder -> builder .selections(newChildren.getChildren(CHILD_SELECTIONS)) ); }
public static Builder newSelectionSet(Collection<? extends Selection> selections) { return new Builder().selections(selections); }
private SelectionSet sortSelectionSet(SelectionSet selectionSet) { if (selectionSet == null) { return null; } List<Selection> selections = sort(selectionSet.getSelections(), comparingSelections()); return selectionSet.transform(builder -> builder.selections(selections)); }
@Override public SelectionSet withNewChildren(NodeChildrenContainer newChildren) { return transform(builder -> builder .selections(newChildren.getChildren(CHILD_SELECTIONS)) ); }