private NodePrinter<ObjectTypeDefinition> objectTypeDefinition() { return (out, node) -> { out.printf("%s", comments(node)); out.printf("%s", spaced( "type", node.getName(), wrap("implements ", join(node.getImplements(), " & "), ""), directives(node.getDirectives()), block(node.getFieldDefinitions()) )); }; }
private Builder(ObjectTypeDefinition existing) { this.sourceLocation = existing.getSourceLocation(); this.comments = existing.getComments(); this.name = existing.getName(); this.description = existing.getDescription(); this.directives = existing.getDirectives(); this.implementz = existing.getImplements(); this.fieldDefinitions = existing.getFieldDefinitions(); this.ignoredChars = existing.getIgnoredChars(); }
@Override public TraversalControl visitObjectTypeDefinition(ObjectTypeDefinition node, TraverserContext<Node> context) { ObjectTypeDefinition changedNode = node.transform(builder -> { builder.directives(sort(node.getDirectives(), comparing(Directive::getName))); builder.implementz(sort(node.getImplements(), comparingTypes())); builder.fieldDefinitions(sort(node.getFieldDefinitions(), comparing(FieldDefinition::getName))); }); return changeNode(context, changedNode); }
buildDirectives(typeDefinition.getDirectives(), directivesOf(extensions), OBJECT, buildCtx.getDirectiveDefinitions()) );
private NodePrinter<ObjectTypeDefinition> objectTypeDefinition() { return (out, node) -> { out.printf("%s", comments(node)); out.printf("%s", spaced( "type", node.getName(), wrap("implements ", join(node.getImplements(), " & "), ""), directives(node.getDirectives()), block(node.getFieldDefinitions()) )); }; }
private static List<Directive> getDirectives(Definition def) { if ( def instanceof ObjectTypeDefinition ) { return ((ObjectTypeDefinition)def).getDirectives(); } if ( def instanceof InterfaceTypeDefinition ) { return ((InterfaceTypeDefinition)def).getDirectives(); } if ( def instanceof EnumTypeDefinition ) { return ((EnumTypeDefinition)def).getDirectives(); } if ( def instanceof ScalarTypeDefinition ) { return ((ScalarTypeDefinition)def).getDirectives(); } if ( def instanceof UnionTypeDefinition ) { return ((UnionTypeDefinition)def).getDirectives(); } if ( def instanceof InputObjectTypeDefinition ) { return ((InputObjectTypeDefinition)def).getDirectives(); } if ( def instanceof SchemaDefinition ) { return ((SchemaDefinition)def).getDirectives(); } return Collections.emptyList(); }
@Override public TraversalControl visitObjectTypeDefinition(ObjectTypeDefinition node, TraverserContext<Node> context) { ObjectTypeDefinition changedNode = node.transform(builder -> { builder.directives(sort(node.getDirectives(), comparing(Directive::getName))); builder.implementz(sort(node.getImplements(), comparingTypes())); builder.fieldDefinitions(sort(node.getFieldDefinitions(), comparing(FieldDefinition::getName))); }); return changeNode(context, changedNode); }
private Builder(ObjectTypeDefinition existing) { this.sourceLocation = existing.getSourceLocation(); this.comments = existing.getComments(); this.name = existing.getName(); this.description = existing.getDescription(); this.directives = existing.getDirectives(); this.implementz = existing.getImplements(); this.fieldDefinitions = existing.getFieldDefinitions(); this.ignoredChars = existing.getIgnoredChars(); }
buildDirectives(typeDefinition.getDirectives(), directivesOf(extensions), OBJECT, buildCtx.getDirectiveDefinitions()) );