@Generated(value="jsii-pacmak/1.73.0 (build 6faeda3)", date="2023-01-31T18:37:02.378Z") public class UnionType extends software.amazon.jsii.JsiiObject implements IIntermediateType
Note that fields of a union type need to be object types. In other words, you can't create a union type out of interfaces, other unions, or inputs.
Example:
GraphqlApi api; GraphqlType string = GraphqlType.string(); ObjectType human = ObjectType.Builder.create("Human").definition(Map.of("name", string)).build(); ObjectType droid = ObjectType.Builder.create("Droid").definition(Map.of("name", string)).build(); ObjectType starship = ObjectType.Builder.create("Starship").definition(Map.of("name", string)).build(); UnionType search = UnionType.Builder.create("Search") .definition(List.of(human, droid, starship)) .build(); api.addType(search);
Modifier and Type | Class and Description |
---|---|
static class |
UnionType.Builder
(experimental) A fluent builder for
UnionType . |
IIntermediateType.Jsii$Default, IIntermediateType.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
UnionType(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
UnionType(software.amazon.jsii.JsiiObjectRef objRef) |
|
UnionType(java.lang.String name,
UnionTypeOptions options) |
Modifier and Type | Method and Description |
---|---|
void |
addField(AddFieldOptions options)
(experimental) Add a field to this Union Type.
|
GraphqlType |
attribute()
(experimental) Create a GraphQL Type representing this Union Type.
|
GraphqlType |
attribute(BaseTypeOptions options)
(experimental) Create a GraphQL Type representing this Union Type.
|
java.util.Map<java.lang.String,IField> |
getDefinition()
(experimental) the attributes of this type.
|
protected java.util.List<AuthorizationType> |
getModes()
(experimental) the authorization modes supported by this intermediate type.
|
java.lang.String |
getName()
(experimental) the name of this type.
|
protected void |
setModes(java.util.List<AuthorizationType> value)
(experimental) the authorization modes supported by this intermediate type.
|
java.lang.String |
toString()
(experimental) Generate the string of this Union type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDirectives, getInterfaceTypes, getIntermediateType, getResolvers, setResolvers
protected UnionType(software.amazon.jsii.JsiiObjectRef objRef)
protected UnionType(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public UnionType(java.lang.String name, UnionTypeOptions options)
name
- This parameter is required.options
- This parameter is required.public void addField(AddFieldOptions options)
Input Types must have field options and the IField must be an Object Type.
addField
in interface IIntermediateType
options
- the options to add a field. This parameter is required.public GraphqlType attribute(BaseTypeOptions options)
attribute
in interface IIntermediateType
options
- the options to configure this attribute.public GraphqlType attribute()
attribute
in interface IIntermediateType
public java.lang.String toString()
toString
in interface IIntermediateType
public java.util.Map<java.lang.String,IField> getDefinition()
getDefinition
in interface IIntermediateType
public java.lang.String getName()
getName
in interface IIntermediateType
protected java.util.List<AuthorizationType> getModes()
protected void setModes(java.util.List<AuthorizationType> value)