@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(), fieldDefinition.getDataFetcher(), fieldDefinition.getArguments(), fieldDefinition.getDeprecationReason()); }
@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()); }
assertEquals(fields.get(0).getDeprecationReason(), "Reason");
@Test public void testDeprecated() { IGraphQLObjectMapper graphQLObjectMapper = newGraphQLObjectMapper( ImmutableList.<IGraphQLTypeMapper> builder().addAll(GraphQLSchemaBuilder.getDefaultTypeMappers()).build()); GraphQLObjectType objectType = (GraphQLObjectType) graphQLObjectMapper.getOutputType(new TypeToken<TestDeprecratedClass>(){}.getType()); assertNotNull(objectType.getFieldDefinition("deprecatedField")); assertTrue(objectType.getFieldDefinition("deprecatedField").isDeprecated()); assertEquals("Old usage", objectType.getFieldDefinition("deprecatedField").getDeprecationReason()); assertTrue(objectType.getFieldDefinition("javaDeprecatedField").isDeprecated()); assertEquals("", objectType.getFieldDefinition("javaDeprecatedField").getDeprecationReason()); }
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()); }