Class UnionType
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.appsync.UnionType
- All Implemented Interfaces:
IIntermediateType
,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:49.578Z")
@Stability(Experimental)
public class UnionType
extends software.amazon.jsii.JsiiObject
implements IIntermediateType
(experimental) Union Types are abstract types that are similar to Interface Types, but they cannot to specify any common fields between types.
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);
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
(experimental) A fluent builder forUnionType
.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.appsync.IIntermediateType
IIntermediateType.Jsii$Default, IIntermediateType.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionUnionType
(String name, UnionTypeOptions options) protected
UnionType
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
UnionType
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addField
(AddFieldOptions options) (experimental) Add a field to this Union Type.(experimental) Create a GraphQL Type representing this Union Type.attribute
(BaseTypeOptions options) (experimental) Create a GraphQL Type representing this Union Type.(experimental) the attributes of this type.protected List<AuthorizationType>
getModes()
(experimental) the authorization modes supported by this intermediate type.getName()
(experimental) the name of this type.protected void
setModes
(List<AuthorizationType> value) (experimental) the authorization modes supported by this intermediate type.toString()
(experimental) Generate the string of this Union type.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.services.appsync.IIntermediateType
getDirectives, getInterfaceTypes, getIntermediateType, getResolvers, setResolvers
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
UnionType
protected UnionType(software.amazon.jsii.JsiiObjectRef objRef) -
UnionType
protected UnionType(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
UnionType
- Parameters:
name
- This parameter is required.options
- This parameter is required.
-
-
Method Details
-
addField
(experimental) Add a field to this Union Type.Input Types must have field options and the IField must be an Object Type.
- Specified by:
addField
in interfaceIIntermediateType
- Parameters:
options
- the options to add a field. This parameter is required.
-
attribute
(experimental) Create a GraphQL Type representing this Union Type.- Specified by:
attribute
in interfaceIIntermediateType
- Parameters:
options
- the options to configure this attribute.
-
attribute
(experimental) Create a GraphQL Type representing this Union Type.- Specified by:
attribute
in interfaceIIntermediateType
-
toString
(experimental) Generate the string of this Union type.- Specified by:
toString
in interfaceIIntermediateType
- Overrides:
toString
in classObject
-
getDefinition
(experimental) the attributes of this type.- Specified by:
getDefinition
in interfaceIIntermediateType
-
getName
(experimental) the name of this type.- Specified by:
getName
in interfaceIIntermediateType
-
getModes
(experimental) the authorization modes supported by this intermediate type. -
setModes
(experimental) the authorization modes supported by this intermediate type.
-