Class UnionShape
- java.lang.Object
-
- software.amazon.smithy.model.shapes.Shape
-
- software.amazon.smithy.model.shapes.UnionShape
-
- All Implemented Interfaces:
java.lang.Comparable<Shape>
,FromSourceLocation
,ToShapeId
,Tagged
,ToSmithyBuilder<UnionShape>
public final class UnionShape extends Shape implements ToSmithyBuilder<UnionShape>
Tagged union shape that maps member names to member definitions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UnionShape.Builder
Builder used to create aUnionShape
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> R
accept(ShapeVisitor<R> cases)
Dispatches the shape to the appropriateShapeVisitor
method.java.util.Optional<UnionShape>
asUnionShape()
static UnionShape.Builder
builder()
boolean
equals(java.lang.Object other)
java.util.Map<java.lang.String,MemberShape>
getAllMembers()
Gets the members of the shape.java.util.Optional<MemberShape>
getMember(java.lang.String name)
Get a specific member by name.java.util.List<java.lang.String>
getMemberNames()
Returns an ordered list of member names based on the order they are defined in the model.java.util.Collection<MemberShape>
members()
Gets all of the members contained in the shape.UnionShape.Builder
toBuilder()
Take this object and create a builder that contains all of the current property values of this object.-
Methods inherited from class software.amazon.smithy.model.shapes.Shape
asBigDecimalShape, asBigIntegerShape, asBlobShape, asBooleanShape, asByteShape, asDocumentShape, asDoubleShape, asFloatShape, asIntegerShape, asListShape, asLongShape, asMapShape, asMemberShape, asOperationShape, asResourceShape, asServiceShape, asSetShape, asShortShape, asStringShape, asStructureShape, asTimestampShape, compareTo, expectTrait, findMemberTrait, findTrait, findTrait, getAllTraits, getId, getMemberTrait, getSourceLocation, getTags, getTrait, getType, hashCode, hasTrait, hasTrait, hasTrait, isBigDecimalShape, isBigIntegerShape, isBlobShape, isBooleanShape, isByteShape, isDocumentShape, isDoubleShape, isFloatShape, isIntegerShape, isListShape, isLongShape, isMapShape, isMemberShape, isOperationShape, isResourceShape, isServiceShape, isSetShape, isShortShape, isStringShape, isStructureShape, isTimestampShape, isUnionShape, shapeToBuilder, toShapeId, toString
-
-
-
-
Method Detail
-
builder
public static UnionShape.Builder builder()
-
toBuilder
public UnionShape.Builder toBuilder()
Description copied from interface:ToSmithyBuilder
Take this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilder
in interfaceToSmithyBuilder<UnionShape>
- Returns:
- a builder for type T
-
accept
public <R> R accept(ShapeVisitor<R> cases)
Description copied from class:Shape
Dispatches the shape to the appropriateShapeVisitor
method.
-
asUnionShape
public java.util.Optional<UnionShape> asUnionShape()
- Overrides:
asUnionShape
in classShape
- Returns:
- Optionally returns the shape as a
UnionShape
.
-
getAllMembers
public java.util.Map<java.lang.String,MemberShape> getAllMembers()
Gets the members of the shape.- Returns:
- Returns the immutable member map.
-
getMemberNames
public java.util.List<java.lang.String> getMemberNames()
Returns an ordered list of member names based on the order they are defined in the model.- Returns:
- Returns an immutable list of member names.
-
getMember
public java.util.Optional<MemberShape> getMember(java.lang.String name)
Get a specific member by name.- Parameters:
name
- Name of the member to retrieve.- Returns:
- Returns the optional member.
-
members
public java.util.Collection<MemberShape> members()
Description copied from class:Shape
Gets all of the members contained in the shape.
-
-