public static final class UnionShape.Builder extends AbstractShapeBuilder<B,S>
UnionShape.| Modifier and Type | Field and Description |
|---|---|
protected software.amazon.smithy.utils.BuilderRef<java.util.Map<java.lang.String,MemberShape>> |
members |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
B |
addMember(MemberShape member)
Adds a member to the shape IFF the shape supports members.
|
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 |
addMixin(Shape shape)
Adds a mixin to the shape.
|
UnionShape |
build() |
B |
clearMembers()
Removes all members from the builder.
|
B |
flattenMixins()
Removes mixins from a shape and flattens them into the shape.
|
java.util.Optional<MemberShape> |
getMember(java.lang.String memberName)
Gets the optional member with the given name.
|
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.
|
B |
removeMixin(ToShapeId shape)
Removes a mixin from the shape by shape or ID.
|
addTrait, addTraits, clearMixins, clearTraits, getAllTraits, getId, getSourceLocation, id, mixins, removeTrait, removeTrait, source, source, traitsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompareprotected final software.amazon.smithy.utils.BuilderRef<java.util.Map<java.lang.String,MemberShape>> members
public UnionShape build()
public ShapeType getShapeType()
AbstractShapeBuildergetShapeType in class AbstractShapeBuilder<UnionShape.Builder,UnionShape>public java.util.Optional<MemberShape> getMember(java.lang.String memberName)
AbstractShapeBuildergetMember in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,S>,S extends Shape>public final B id(ShapeId shapeId)
AbstractShapeBuilderid in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,S>,S extends Shape>shapeId - Shape ID to set.public B members(java.util.Collection<MemberShape> members)
members - Members to add to the builder.public B clearMembers()
AbstractShapeBuilderclearMembers in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,S>,S extends Shape>public B addMember(MemberShape member)
AbstractShapeBuilderaddMember in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,S>,S extends Shape>member - Member to add to the shape.public B addMember(java.lang.String memberName,
ShapeId target)
memberName - Member name to add.target - Target of the member.public B addMember(java.lang.String memberName,
ShapeId target,
java.util.function.Consumer<MemberShape.Builder> memberUpdater)
memberName - Member name to add.target - Target of the member.memberUpdater - Consumer that can update the created member shape.public B removeMember(java.lang.String member)
Note that removing a member that was added by a mixin results in an inconsistent model. It's best to use ModelTransform to ensure that the model remains consistent when removing members.
member - Member name to remove.public B addMixin(Shape shape)
AbstractShapeBuilderaddMixin in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,S>,S extends Shape>shape - Mixin to add.public B removeMixin(ToShapeId shape)
AbstractShapeBuilderremoveMixin in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,S>,S extends Shape>shape - Shape or shape ID to remove.public B flattenMixins()
AbstractShapeBuilderFlattening a mixin into a shape copies the traits and members of a mixin onto the shape, effectively resulting in the same shape but with no trace of the mixin relationship.
flattenMixins in class AbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,S>,S extends Shape>