@PublicApi public class GraphQLUnionType extends java.lang.Object implements GraphQLType, GraphQLOutputType, GraphQLCompositeType, GraphQLUnmodifiedType, GraphQLNullableType, GraphQLDirectiveContainer
TypeResolver
is used to take an union object value and decide what GraphQLObjectType
represents this union of types.
Note that members of a union type need to be concrete object types; you can't create a union type out of interfaces or other unions.
See http://graphql.org/learn/schema/#union-types for more details on the concept.Modifier and Type | Class and Description |
---|---|
static class |
GraphQLUnionType.Builder |
Constructor and Description |
---|
GraphQLUnionType(java.lang.String name,
java.lang.String description,
java.util.List<GraphQLOutputType> types,
TypeResolver typeResolver) |
GraphQLUnionType(java.lang.String name,
java.lang.String description,
java.util.List<GraphQLOutputType> types,
TypeResolver typeResolver,
java.util.List<GraphQLDirective> directives,
UnionTypeDefinition definition) |
Modifier and Type | Method and Description |
---|---|
TraversalControl |
accept(TraverserContext<GraphQLType> context,
GraphQLTypeVisitor visitor)
Double-dispatch entry point.
|
java.util.List<GraphQLType> |
getChildren() |
UnionTypeDefinition |
getDefinition() |
java.lang.String |
getDescription() |
java.util.List<GraphQLDirective> |
getDirectives() |
java.lang.String |
getName() |
TypeResolver |
getTypeResolver() |
java.util.List<GraphQLOutputType> |
getTypes() |
static GraphQLUnionType.Builder |
newUnionType() |
static GraphQLUnionType.Builder |
newUnionType(GraphQLUnionType existing) |
GraphQLUnionType |
transform(java.util.function.Consumer<GraphQLUnionType.Builder> builderConsumer)
This helps you transform the current GraphQLUnionType into another one by starting a builder with all
the current values and allows you to transform it how you want.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDirective, getDirectivesByName
public GraphQLUnionType(java.lang.String name, java.lang.String description, java.util.List<GraphQLOutputType> types, TypeResolver typeResolver)
public GraphQLUnionType(java.lang.String name, java.lang.String description, java.util.List<GraphQLOutputType> types, TypeResolver typeResolver, java.util.List<GraphQLDirective> directives, UnionTypeDefinition definition)
public java.util.List<GraphQLOutputType> getTypes()
public TypeResolver getTypeResolver()
public java.lang.String getName()
getName
in interface GraphQLType
[_A-Za-z][_0-9A-Za-z]*
public java.lang.String getDescription()
public UnionTypeDefinition getDefinition()
public java.util.List<GraphQLDirective> getDirectives()
getDirectives
in interface GraphQLDirectiveContainer
public GraphQLUnionType transform(java.util.function.Consumer<GraphQLUnionType.Builder> builderConsumer)
builderConsumer
- the consumer code that will be given a builder to transformpublic TraversalControl accept(TraverserContext<GraphQLType> context, GraphQLTypeVisitor visitor)
GraphQLType
Node
, see accept(...) for more details about the pattern.accept
in interface GraphQLType
context
- TraverserContext bound to this graphQL type objectvisitor
- Visitor instance that performs actual processing on the types(s)public java.util.List<GraphQLType> getChildren()
getChildren
in interface GraphQLType
public static GraphQLUnionType.Builder newUnionType()
public static GraphQLUnionType.Builder newUnionType(GraphQLUnionType existing)