@PublicApi public class GraphQLEnumType extends java.lang.Object implements GraphQLNamedInputType, GraphQLNamedOutputType, GraphQLUnmodifiedType, GraphQLNullableType, GraphQLDirectiveContainer
This allows you to validate that any arguments of this type are one of the allowed values and communicate through the type system that a field will always be one of a finite set of values.
See http://graphql.org/learn/schema/#enumeration-types for more details
Modifier and Type | Class and Description |
---|---|
static class |
GraphQLEnumType.Builder |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHILD_DIRECTIVES |
static java.lang.String |
CHILD_VALUES |
Constructor and Description |
---|
GraphQLEnumType(java.lang.String name,
java.lang.String description,
java.util.List<GraphQLEnumValueDefinition> values)
Deprecated.
use the
newEnum() builder pattern instead, as this constructor will be made private in a future version. |
GraphQLEnumType(java.lang.String name,
java.lang.String description,
java.util.List<GraphQLEnumValueDefinition> values,
java.util.List<GraphQLDirective> directives,
EnumTypeDefinition definition)
Deprecated.
use the
newEnum() builder pattern instead, as this constructor will be made private in a future version. |
Modifier and Type | Method and Description |
---|---|
TraversalControl |
accept(TraverserContext<GraphQLSchemaElement> context,
GraphQLTypeVisitor visitor) |
java.util.List<GraphQLSchemaElement> |
getChildren() |
SchemaElementChildrenContainer |
getChildrenWithTypeReferences() |
EnumTypeDefinition |
getDefinition()
The AST
Node this schema element is based on. |
java.lang.String |
getDescription() |
java.util.List<GraphQLDirective> |
getDirectives() |
java.util.List<EnumTypeExtensionDefinition> |
getExtensionDefinitions() |
java.lang.String |
getName() |
GraphQLEnumValueDefinition |
getValue(java.lang.String name) |
java.util.List<GraphQLEnumValueDefinition> |
getValues() |
static GraphQLEnumType.Builder |
newEnum() |
static GraphQLEnumType.Builder |
newEnum(GraphQLEnumType existing) |
java.lang.Object |
parseLiteral(java.lang.Object input) |
java.lang.Object |
parseValue(java.lang.Object input) |
java.lang.Object |
serialize(java.lang.Object input) |
GraphQLEnumType |
transform(java.util.function.Consumer<GraphQLEnumType.Builder> builderConsumer)
This helps you transform the current GraphQLEnumType into another one by starting a builder with all
the current values and allows you to transform it how you want.
|
GraphQLEnumType |
withNewChildren(SchemaElementChildrenContainer newChildren) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDirective, getDirectivesByName
public static final java.lang.String CHILD_VALUES
public static final java.lang.String CHILD_DIRECTIVES
@Deprecated public GraphQLEnumType(java.lang.String name, java.lang.String description, java.util.List<GraphQLEnumValueDefinition> values)
newEnum()
builder pattern instead, as this constructor will be made private in a future version.name
- the namedescription
- the descriptionvalues
- the values@Deprecated public GraphQLEnumType(java.lang.String name, java.lang.String description, java.util.List<GraphQLEnumValueDefinition> values, java.util.List<GraphQLDirective> directives, EnumTypeDefinition definition)
newEnum()
builder pattern instead, as this constructor will be made private in a future version.name
- the namedescription
- the descriptionvalues
- the valuesdirectives
- the directives on this type elementdefinition
- the AST definitionpublic java.lang.Object serialize(java.lang.Object input)
public java.lang.Object parseValue(java.lang.Object input)
public java.lang.Object parseLiteral(java.lang.Object input)
public java.util.List<GraphQLEnumValueDefinition> getValues()
public GraphQLEnumValueDefinition getValue(java.lang.String name)
public java.lang.String getName()
getName
in interface GraphQLNamedSchemaElement
public java.lang.String getDescription()
getDescription
in interface GraphQLNamedSchemaElement
public EnumTypeDefinition getDefinition()
GraphQLNamedSchemaElement
Node
this schema element is based on. Is null if the GraphQLSchema
is not based on a SDL document.
Some elements also have additional extension Nodes. See for example GraphQLObjectType.getExtensionDefinitions()
getDefinition
in interface GraphQLNamedSchemaElement
public java.util.List<EnumTypeExtensionDefinition> getExtensionDefinitions()
public java.util.List<GraphQLDirective> getDirectives()
getDirectives
in interface GraphQLDirectiveContainer
public GraphQLEnumType transform(java.util.function.Consumer<GraphQLEnumType.Builder> builderConsumer)
builderConsumer
- the consumer code that will be given a builder to transformpublic TraversalControl accept(TraverserContext<GraphQLSchemaElement> context, GraphQLTypeVisitor visitor)
accept
in interface GraphQLSchemaElement
public java.util.List<GraphQLSchemaElement> getChildren()
getChildren
in interface GraphQLSchemaElement
public SchemaElementChildrenContainer getChildrenWithTypeReferences()
getChildrenWithTypeReferences
in interface GraphQLSchemaElement
public GraphQLEnumType withNewChildren(SchemaElementChildrenContainer newChildren)
withNewChildren
in interface GraphQLSchemaElement
public static GraphQLEnumType.Builder newEnum()
public static GraphQLEnumType.Builder newEnum(GraphQLEnumType existing)