@SuppressWarnings("unchecked") public Builder(GraphQLFieldDefinition existing) { this.name = existing.getName(); this.description = existing.getDescription(); this.type = existing.getType(); this.dataFetcherFactory = DataFetcherFactories.useDataFetcher(existing.getDataFetcher()); this.deprecationReason = existing.getDeprecationReason(); this.definition = existing.getDefinition(); this.arguments.putAll(getByName(existing.getArguments(), GraphQLArgument::getName)); this.directives.putAll(getByName(existing.getDirectives(), GraphQLDirective::getName)); }
} else if (descriptionHolder instanceof GraphQLFieldDefinition) { GraphQLFieldDefinition type = (GraphQLFieldDefinition) descriptionHolder; return descriptionAndComments(type::getDescription, type::getDefinition, () -> type.getDefinition().getDescription()); } else if (descriptionHolder instanceof GraphQLEnumValueDefinition) { GraphQLEnumValueDefinition type = (GraphQLEnumValueDefinition) descriptionHolder;
public static Optional<String> getDirectiveArgument(GraphQLFieldDefinition field, String directiveName, String argumentName) { return Optional.ofNullable(field.getDefinition().getDirective(directiveName)) .map(d -> d.getArgument(argumentName)) .map(v -> (StringValue) v.getValue()) .map(StringValue::getValue); } }
@SuppressWarnings("unchecked") public Builder(GraphQLFieldDefinition existing) { this.name = existing.getName(); this.description = existing.getDescription(); this.type = existing.getType(); this.dataFetcherFactory = DataFetcherFactories.useDataFetcher(existing.getDataFetcher()); this.deprecationReason = existing.getDeprecationReason(); this.definition = existing.getDefinition(); this.arguments.putAll(getByName(existing.getArguments(), GraphQLArgument::getName)); this.directives.putAll(getByName(existing.getDirectives(), GraphQLDirective::getName)); }
public GraphQLFieldDefinitionWrapper(GraphQLFieldDefinition fieldDefinition) { super(fieldDefinition.getName(), fieldDefinition.getDescription(), fieldDefinition.getType(), DataFetcherFactories.useDataFetcher((DataFetcher<?>) fieldDefinition.getDataFetcher()), fieldDefinition.getArguments(), fieldDefinition.getDeprecationReason(), fieldDefinition.getDirectives(), fieldDefinition.getDefinition()); }
public static Builder notNull (Builder aSource) { GraphQLFieldDefinition field = aSource.build(); return create(field.getName()).argument(field.getArguments()) .type(new GraphQLNonNull(field.getType())) .dataFetcher(field.getDataFetcher()) .definition(field.getDefinition()) .deprecate(field.getDeprecationReason()) .description(field.getDescription()); }
} else if (descriptionHolder instanceof GraphQLFieldDefinition) { GraphQLFieldDefinition type = (GraphQLFieldDefinition) descriptionHolder; return descriptionAndComments(type::getDescription, type::getDefinition, () -> type.getDefinition().getDescription()); } else if (descriptionHolder instanceof GraphQLEnumValueDefinition) { GraphQLEnumValueDefinition type = (GraphQLEnumValueDefinition) descriptionHolder;