Package graphql.schema
Class GraphQLFieldDefinition.Builder
- java.lang.Object
-
- graphql.schema.GraphqlTypeBuilder<BASE>
-
- graphql.schema.GraphqlDirectivesContainerTypeBuilder<GraphQLFieldDefinition.Builder,GraphQLFieldDefinition.Builder>
-
- graphql.schema.GraphQLFieldDefinition.Builder
-
- Enclosing class:
- GraphQLFieldDefinition
@PublicApi public static class GraphQLFieldDefinition.Builder extends GraphqlDirectivesContainerTypeBuilder<GraphQLFieldDefinition.Builder,GraphQLFieldDefinition.Builder>
-
-
Field Summary
-
Fields inherited from class graphql.schema.GraphqlDirectivesContainerTypeBuilder
appliedDirectives, directives
-
Fields inherited from class graphql.schema.GraphqlTypeBuilder
comparatorRegistry, description, name
-
-
Constructor Summary
Constructors Constructor Description Builder()
Builder(GraphQLFieldDefinition existing)
-
Method Summary
-
Methods inherited from class graphql.schema.GraphqlDirectivesContainerTypeBuilder
copyExistingDirectives, replaceAppliedDirectives, withAppliedDirective, withAppliedDirective, withAppliedDirectives
-
Methods inherited from class graphql.schema.GraphqlTypeBuilder
comparatorRegistry
-
-
-
-
Constructor Detail
-
Builder
public Builder()
-
Builder
public Builder(GraphQLFieldDefinition existing)
-
-
Method Detail
-
definition
public GraphQLFieldDefinition.Builder definition(FieldDefinition definition)
-
type
public GraphQLFieldDefinition.Builder type(GraphQLObjectType.Builder builder)
-
type
public GraphQLFieldDefinition.Builder type(GraphQLInterfaceType.Builder builder)
-
type
public GraphQLFieldDefinition.Builder type(GraphQLUnionType.Builder builder)
-
type
public GraphQLFieldDefinition.Builder type(GraphQLOutputType type)
-
dataFetcher
@Deprecated public GraphQLFieldDefinition.Builder dataFetcher(DataFetcher<?> dataFetcher)
Deprecated.useGraphQLCodeRegistry
insteadSets theDataFetcher
to use with this field.- Parameters:
dataFetcher
- the data fetcher to use- Returns:
- this builder
-
dataFetcherFactory
@Deprecated public GraphQLFieldDefinition.Builder dataFetcherFactory(DataFetcherFactory<?> dataFetcherFactory)
Deprecated.useGraphQLCodeRegistry
insteadSets theDataFetcherFactory
to use with this field.- Parameters:
dataFetcherFactory
- the data fetcher factory- Returns:
- this builder
-
staticValue
@Deprecated public GraphQLFieldDefinition.Builder staticValue(java.lang.Object value)
Deprecated.useGraphQLCodeRegistry
insteadThis will cause the data fetcher of this field to always return the supplied value- Parameters:
value
- the value to always return- Returns:
- this builder
-
argument
public GraphQLFieldDefinition.Builder argument(GraphQLArgument argument)
-
argument
public GraphQLFieldDefinition.Builder argument(java.util.function.UnaryOperator<GraphQLArgument.Builder> builderFunction)
Take an argument builder in a function definition and apply. Can be used in a jdk8 lambda e.g.:argument(a -> a.name("argumentName"))
- Parameters:
builderFunction
- a supplier for the builder impl- Returns:
- this
-
argument
public GraphQLFieldDefinition.Builder argument(GraphQLArgument.Builder builder)
Same effect as the argument(GraphQLArgument). Builder.build() is called from within- Parameters:
builder
- an un-built/incomplete GraphQLArgument- Returns:
- this
-
argument
@Deprecated public GraphQLFieldDefinition.Builder argument(java.util.List<GraphQLArgument> arguments)
Deprecated.This is a badly named method and is replaced byarguments(java.util.List)
This adds the list of arguments to the field.- Parameters:
arguments
- the arguments to add- Returns:
- this
-
arguments
public GraphQLFieldDefinition.Builder arguments(java.util.List<GraphQLArgument> arguments)
This adds the list of arguments to the field.- Parameters:
arguments
- the arguments to add- Returns:
- this
-
replaceArguments
public GraphQLFieldDefinition.Builder replaceArguments(java.util.List<GraphQLArgument> arguments)
-
clearArguments
public GraphQLFieldDefinition.Builder clearArguments()
This is used to clear all the arguments in the builder so far.- Returns:
- the builder
-
deprecate
public GraphQLFieldDefinition.Builder deprecate(java.lang.String deprecationReason)
-
replaceDirectives
public GraphQLFieldDefinition.Builder replaceDirectives(java.util.List<GraphQLDirective> directives)
- Overrides:
replaceDirectives
in classGraphqlDirectivesContainerTypeBuilder<GraphQLFieldDefinition.Builder,GraphQLFieldDefinition.Builder>
- Parameters:
directives
- the list of directives- Returns:
- this builder
-
withDirectives
public GraphQLFieldDefinition.Builder withDirectives(GraphQLDirective... directives)
- Overrides:
withDirectives
in classGraphqlDirectivesContainerTypeBuilder<GraphQLFieldDefinition.Builder,GraphQLFieldDefinition.Builder>
- Parameters:
directives
- the variable args of directives- Returns:
- this builder
-
withDirective
public GraphQLFieldDefinition.Builder withDirective(GraphQLDirective directive)
- Overrides:
withDirective
in classGraphqlDirectivesContainerTypeBuilder<GraphQLFieldDefinition.Builder,GraphQLFieldDefinition.Builder>
- Parameters:
directive
- the directive to add- Returns:
- this builder
-
withDirective
public GraphQLFieldDefinition.Builder withDirective(GraphQLDirective.Builder builder)
- Overrides:
withDirective
in classGraphqlDirectivesContainerTypeBuilder<GraphQLFieldDefinition.Builder,GraphQLFieldDefinition.Builder>
- Parameters:
builder
- the directive builder- Returns:
- this builder
-
clearDirectives
public GraphQLFieldDefinition.Builder clearDirectives()
Description copied from class:GraphqlDirectivesContainerTypeBuilder
This is used to clear all the directives in the builder so far.- Overrides:
clearDirectives
in classGraphqlDirectivesContainerTypeBuilder<GraphQLFieldDefinition.Builder,GraphQLFieldDefinition.Builder>
- Returns:
- the builder
-
name
public GraphQLFieldDefinition.Builder name(java.lang.String name)
- Overrides:
name
in classGraphqlTypeBuilder<GraphQLFieldDefinition.Builder>
-
description
public GraphQLFieldDefinition.Builder description(java.lang.String description)
- Overrides:
description
in classGraphqlTypeBuilder<GraphQLFieldDefinition.Builder>
-
build
public GraphQLFieldDefinition build()
-
-