Class UnionShape.Builder
- java.lang.Object
-
- software.amazon.smithy.model.shapes.AbstractShapeBuilder<B,S>
-
- software.amazon.smithy.model.shapes.UnionShape.Builder
-
- All Implemented Interfaces:
FromSourceLocation
,SmithyBuilder<UnionShape>
- Enclosing class:
- UnionShape
public static final class UnionShape.Builder extends AbstractShapeBuilder<B,S>
Builder used to create aUnionShape
.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description B
addMember(java.lang.String memberName, ShapeId target)
Adds a member to the builder.B
addMember(java.lang.String memberName, ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Adds a member to the builder.B
addMember(MemberShape member)
Adds a member to the builder.UnionShape
build()
Creates an immutable object that is created from the properties that have been set on the builder.B
clearMembers()
Removes all members from the shape.ShapeType
getShapeType()
Gets the type of shape being built.B
id(ShapeId shapeId)
Sets the shape ID of the shape.B
members(java.util.Collection<MemberShape> members)
Replaces the members of the builder.B
removeMember(java.lang.String member)
Removes a member by name.-
Methods inherited from class software.amazon.smithy.model.shapes.AbstractShapeBuilder
addTrait, addTraits, clearTraits, getId, getSourceLocation, id, removeTrait, removeTrait, source, source, traits
-
-
-
-
Method Detail
-
build
public UnionShape build()
Description copied from interface:SmithyBuilder
Creates an immutable object that is created from the properties that have been set on the builder.- Returns:
- an instance of T
-
getShapeType
public ShapeType getShapeType()
Description copied from class:AbstractShapeBuilder
Gets the type of shape being built.- Specified by:
getShapeType
in classAbstractShapeBuilder<UnionShape.Builder,UnionShape>
- Returns:
- Returns the shape type.
-
id
public final B id(ShapeId shapeId)
Description copied from class:AbstractShapeBuilder
Sets the shape ID of the shape.- Overrides:
id
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShape.Builder,S extends software.amazon.smithy.model.shapes.NamedMembersShape>
- Parameters:
shapeId
- Shape ID to set.- Returns:
- Returns the builder.
-
members
public B members(java.util.Collection<MemberShape> members)
Replaces the members of the builder.- Parameters:
members
- Members to add to the builder.- Returns:
- Returns the builder.
-
clearMembers
public B clearMembers()
Removes all members from the shape.- Returns:
- Returns the builder.
-
addMember
public B addMember(MemberShape member)
Adds a member to the builder.- Overrides:
addMember
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShape.Builder,S extends software.amazon.smithy.model.shapes.NamedMembersShape>
- Parameters:
member
- Shape targeted by the member.- Returns:
- Returns the builder.
-
addMember
public B addMember(java.lang.String memberName, ShapeId target)
Adds a member to the builder.- Parameters:
memberName
- Member name to add.target
- Target of the member.- Returns:
- Returns the builder.
-
addMember
public B addMember(java.lang.String memberName, ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Adds a member to the builder.- Parameters:
memberName
- Member name to add.target
- Target of the member.memberUpdater
- Consumer that can update the created member shape.- Returns:
- Returns the builder.
-
removeMember
public B removeMember(java.lang.String member)
Removes a member by name.- Parameters:
member
- Member name to remove.- Returns:
- Returns the builder.
-
-