@Generated(value="jsii-pacmak/1.70.0 (build 03c2f6f)", date="2022-11-01T13:16:42.889Z") @Stability(value=Experimental) 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. |
software.amazon.jsii.JsiiObject.InitializationModeIIntermediateType.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(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.
|
Map<String,IField> |
getDefinition()
(experimental) the attributes of this type.
|
protected List<AuthorizationType> |
getModes()
(experimental) the authorization modes supported by this intermediate type.
|
String |
getName()
(experimental) the name of this type.
|
protected void |
setModes(List<AuthorizationType> value)
(experimental) the authorization modes supported by this intermediate type.
|
String |
toString()
(experimental) Generate the string of this Union type.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDirectives, getInterfaceTypes, getIntermediateType, getResolvers, setResolversprotected UnionType(software.amazon.jsii.JsiiObjectRef objRef)
protected UnionType(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental)
public UnionType(@NotNull
String name,
@NotNull
UnionTypeOptions options)
name - This parameter is required.options - This parameter is required.@Stability(value=Experimental)
public void addField(@NotNull
AddFieldOptions options)
Input Types must have field options and the IField must be an Object Type.
addField in interface IIntermediateTypeoptions - the options to add a field. This parameter is required.@Stability(value=Experimental) @NotNull public GraphqlType attribute(@Nullable BaseTypeOptions options)
attribute in interface IIntermediateTypeoptions - the options to configure this attribute.@Stability(value=Experimental) @NotNull public GraphqlType attribute()
attribute in interface IIntermediateType@Stability(value=Experimental) @NotNull public String toString()
toString in interface IIntermediateTypetoString in class Object@Stability(value=Experimental) @NotNull public Map<String,IField> getDefinition()
getDefinition in interface IIntermediateType@Stability(value=Experimental) @NotNull public String getName()
getName in interface IIntermediateType@Stability(value=Experimental) @Nullable protected List<AuthorizationType> getModes()
@Stability(value=Experimental)
protected void setModes(@Nullable
List<AuthorizationType> value)
Copyright © 2022. All rights reserved.