protected DirectiveDefinition createDirectiveDefinition(GraphqlParser.DirectiveDefinitionContext ctx) { DirectiveDefinition.Builder def = DirectiveDefinition.newDirectiveDefinition(); def.name(ctx.name().getText()); addCommonData(def, ctx); def.description(newDescription(ctx.description())); GraphqlParser.DirectiveLocationsContext directiveLocationsContext = ctx.directiveLocations(); List<DirectiveLocation> directiveLocations = new ArrayList<>(); while (directiveLocationsContext != null) { directiveLocations.add(0, createDirectiveLocation(directiveLocationsContext.directiveLocation())); directiveLocationsContext = directiveLocationsContext.directiveLocations(); } def.directiveLocations(directiveLocations); if (ctx.argumentsDefinition() != null) { def.inputValueDefinitions(createInputValueDefinitions(ctx.argumentsDefinition().inputValueDefinition())); } return def.build(); }
protected DirectiveDefinition createDirectiveDefinition(GraphqlParser.DirectiveDefinitionContext ctx) { DirectiveDefinition.Builder def = DirectiveDefinition.newDirectiveDefinition(); def.name(ctx.name().getText()); addCommonData(def, ctx); def.description(newDescription(ctx.description())); GraphqlParser.DirectiveLocationsContext directiveLocationsContext = ctx.directiveLocations(); List<DirectiveLocation> directiveLocations = new ArrayList<>(); while (directiveLocationsContext != null) { directiveLocations.add(0, createDirectiveLocation(directiveLocationsContext.directiveLocation())); directiveLocationsContext = directiveLocationsContext.directiveLocations(); } def.directiveLocations(directiveLocations); if (ctx.argumentsDefinition() != null) { def.inputValueDefinitions(createInputValueDefinitions(ctx.argumentsDefinition().inputValueDefinition())); } return def.build(); }
public static Builder newDirectiveDefinition() { return new Builder(); }
@Override public TraversalControl visitDirectiveDefinition(DirectiveDefinition node, TraverserContext<Node> context) { DirectiveDefinition changedNode = node.transform(builder -> { builder.inputValueDefinitions(sort(node.getInputValueDefinitions(), comparing(InputValueDefinition::getName))); builder.directiveLocations(sort(node.getDirectiveLocations(), comparing(DirectiveLocation::getName))); }); return changeNode(context, changedNode); } };
@Override public DirectiveDefinition withNewChildren(NodeChildrenContainer newChildren) { return transform(builder -> builder .inputValueDefinitions(newChildren.getChildren(CHILD_INPUT_VALUE_DEFINITIONS)) .directiveLocations(newChildren.getChildren(CHILD_DIRECTIVE_LOCATION)) ); }
public static Builder newDirectiveDefinition() { return new Builder(); }
@Override public TraversalControl visitDirectiveDefinition(DirectiveDefinition node, TraverserContext<Node> context) { DirectiveDefinition changedNode = node.transform(builder -> { builder.inputValueDefinitions(sort(node.getInputValueDefinitions(), comparing(InputValueDefinition::getName))); builder.directiveLocations(sort(node.getDirectiveLocations(), comparing(DirectiveLocation::getName))); }); return changeNode(context, changedNode); } };
@Override public DirectiveDefinition withNewChildren(NodeChildrenContainer newChildren) { return transform(builder -> builder .inputValueDefinitions(newChildren.getChildren(CHILD_INPUT_VALUE_DEFINITIONS)) .directiveLocations(newChildren.getChildren(CHILD_DIRECTIVE_LOCATION)) ); }