Class IntEnumShape.Builder
- java.lang.Object
-
- software.amazon.smithy.model.shapes.AbstractShapeBuilder<IntegerShape.Builder,IntegerShape>
-
- software.amazon.smithy.model.shapes.IntegerShape.Builder
-
- software.amazon.smithy.model.shapes.IntEnumShape.Builder
-
- All Implemented Interfaces:
FromSourceLocation,SmithyBuilder<IntegerShape>
- Enclosing class:
- IntEnumShape
public static class IntEnumShape.Builder extends IntegerShape.Builder
Builder used to create aIntegerShape.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntEnumShape.BuilderaddMember(java.lang.String memberName, int enumValue)Adds a member to the builder.IntEnumShape.BuilderaddMember(java.lang.String memberName, int enumValue, java.util.function.Consumer<MemberShape.Builder> memberUpdater)Adds a member to the builder.IntEnumShape.BuilderaddMember(MemberShape member)Adds a member to the shape IFF the shape supports members.IntEnumShape.BuilderaddMixin(Shape shape)Adds a mixin to the shape.IntEnumShapebuild()Creates an immutable object that is created from the properties that have been set on the builder.IntEnumShape.BuilderclearMembers()Removes all members from the builder.IntEnumShape.BuilderflattenMixins()Removes mixins from a shape and flattens them into the shape.ShapeTypegetShapeType()Gets the type of shape being built.IntEnumShape.Builderid(java.lang.String shapeId)Sets the shape ID of the shape.IntEnumShape.Builderid(ShapeId shapeId)Sets the shape ID of the shape.IntEnumShape.Buildermembers(java.util.Collection<MemberShape> members)Replaces the members of the builder.IntEnumShape.BuilderremoveMember(java.lang.String member)Removes a member by name.IntEnumShape.BuilderremoveMixin(ToShapeId shape)Removes a mixin from the shape by shape or ID.-
Methods inherited from class software.amazon.smithy.model.shapes.AbstractShapeBuilder
addTrait, addTraits, clearMixins, clearTraits, getAllTraits, getId, getMember, getSourceLocation, mixins, removeTrait, removeTrait, source, source, traits
-
-
-
-
Method Detail
-
build
public IntEnumShape build()
Description copied from interface:SmithyBuilderCreates an immutable object that is created from the properties that have been set on the builder.- Specified by:
buildin interfaceSmithyBuilder<IntegerShape>- Overrides:
buildin classIntegerShape.Builder- Returns:
- an instance of T
-
getShapeType
public ShapeType getShapeType()
Description copied from class:AbstractShapeBuilderGets the type of shape being built.- Overrides:
getShapeTypein classIntegerShape.Builder- Returns:
- Returns the shape type.
-
id
public IntEnumShape.Builder id(ShapeId shapeId)
Description copied from class:AbstractShapeBuilderSets the shape ID of the shape.- Overrides:
idin classAbstractShapeBuilder<IntegerShape.Builder,IntegerShape>- Parameters:
shapeId- Shape ID to set.- Returns:
- Returns the builder.
-
id
public IntEnumShape.Builder id(java.lang.String shapeId)
Description copied from class:AbstractShapeBuilderSets the shape ID of the shape.- Overrides:
idin classAbstractShapeBuilder<IntegerShape.Builder,IntegerShape>- Parameters:
shapeId- Absolute shape ID string to set.- Returns:
- Returns the builder.
-
members
public IntEnumShape.Builder 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 IntEnumShape.Builder clearMembers()
Description copied from class:AbstractShapeBuilderRemoves all members from the builder.- Overrides:
clearMembersin classAbstractShapeBuilder<IntegerShape.Builder,IntegerShape>- Returns:
- Returns the builder.
-
addMember
public IntEnumShape.Builder addMember(MemberShape member)
Description copied from class:AbstractShapeBuilderAdds a member to the shape IFF the shape supports members.- Overrides:
addMemberin classAbstractShapeBuilder<IntegerShape.Builder,IntegerShape>- Parameters:
member- Member to add to the shape.- Returns:
- Returns the builder.
-
addMember
public IntEnumShape.Builder addMember(java.lang.String memberName, int enumValue)
Adds a member to the builder.- Parameters:
memberName- Member name to add.enumValue- The value of the enum.- Returns:
- Returns the builder.
-
addMember
public IntEnumShape.Builder addMember(java.lang.String memberName, int enumValue, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Adds a member to the builder.- Parameters:
memberName- Member name to add.enumValue- The value of the enum.memberUpdater- Consumer that can update the created member shape.- Returns:
- Returns the builder.
-
removeMember
public IntEnumShape.Builder removeMember(java.lang.String member)
Removes a member by name.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.
- Parameters:
member- Member name to remove.- Returns:
- Returns the builder.
-
addMixin
public IntEnumShape.Builder addMixin(Shape shape)
Description copied from class:AbstractShapeBuilderAdds a mixin to the shape.- Overrides:
addMixinin classAbstractShapeBuilder<IntegerShape.Builder,IntegerShape>- Parameters:
shape- Mixin to add.- Returns:
- Returns the builder.
-
removeMixin
public IntEnumShape.Builder removeMixin(ToShapeId shape)
Description copied from class:AbstractShapeBuilderRemoves a mixin from the shape by shape or ID.- Overrides:
removeMixinin classAbstractShapeBuilder<IntegerShape.Builder,IntegerShape>- Parameters:
shape- Shape or shape ID to remove.- Returns:
- Returns the builder.
-
flattenMixins
public IntEnumShape.Builder flattenMixins()
Description copied from class:AbstractShapeBuilderRemoves mixins from a shape and flattens them into the shape.Flattening 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.
- Overrides:
flattenMixinsin classAbstractShapeBuilder<IntegerShape.Builder,IntegerShape>- Returns:
- Returns the updated builder.
-
-