Class StructureShape.Builder
java.lang.Object
software.amazon.smithy.model.shapes.AbstractShapeBuilder<B,S>
software.amazon.smithy.model.shapes.StructureShape.Builder
- All Implemented Interfaces:
FromSourceLocation
,SmithyBuilder<StructureShape>
- Enclosing class:
- StructureShape
Builder used to create a
StructureShape
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a member to the builder.addMember
(String memberName, ShapeId target, Consumer<MemberShape.Builder> memberUpdater) Adds a member to the builder.addMember
(MemberShape member) Adds a member to the shape IFF the shape supports members.Adds a mixin to the shape.build()
Creates an immutable object that is created from the properties that have been set on the builder.Removes all members from the builder.Removes mixins from a shape and flattens them into the shape.Gets the optional member with the given name.Gets the type of shape being built.final StructureShape.Builder
Sets the shape ID of the shape.members
(Collection<MemberShape> members) Replaces the members of the builder.removeMember
(String member) Removes a member by name.removeMixin
(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, getSourceLocation, id, mixins, removeTrait, removeTrait, source, source, traits
-
Field Details
-
members
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
Description copied from class:AbstractShapeBuilder
Gets the type of shape being built.- Specified by:
getShapeType
in classAbstractShapeBuilder<StructureShape.Builder,
StructureShape> - Returns:
- Returns the shape type.
-
getMember
Description copied from class:AbstractShapeBuilder
Gets the optional member with the given name.- Overrides:
getMember
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,
S>, S extends Shape> - Returns:
- Returns the optional member with the given name.
-
id
Description copied from class:AbstractShapeBuilder
Sets the shape ID of the shape.- Overrides:
id
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,
S>, S extends Shape> - Parameters:
shapeId
- Shape ID to set.- Returns:
- Returns the builder.
-
members
Replaces the members of the builder.- Parameters:
members
- Members to add to the builder.- Returns:
- Returns the builder.
-
clearMembers
Description copied from class:AbstractShapeBuilder
Removes all members from the builder.- Overrides:
clearMembers
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,
S>, S extends Shape> - Returns:
- Returns the builder.
-
addMember
Description copied from class:AbstractShapeBuilder
Adds a member to the shape IFF the shape supports members.- Overrides:
addMember
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,
S>, S extends Shape> - Parameters:
member
- Member to add to the shape.- Returns:
- Returns the builder.
-
addMember
Adds a member to the builder.- Parameters:
memberName
- Member name to add.target
- Target of the member.- Returns:
- Returns the builder.
-
addMember
public StructureShape.Builder addMember(String memberName, ShapeId target, 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
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
Description copied from class:AbstractShapeBuilder
Adds a mixin to the shape.- Overrides:
addMixin
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,
S>, S extends Shape> - Parameters:
shape
- Mixin to add.- Returns:
- Returns the builder.
-
removeMixin
Description copied from class:AbstractShapeBuilder
Removes a mixin from the shape by shape or ID.- Overrides:
removeMixin
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,
S>, S extends Shape> - Parameters:
shape
- Shape or shape ID to remove.- Returns:
- Returns the builder.
-
flattenMixins
Description copied from class:AbstractShapeBuilder
Removes 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:
flattenMixins
in classAbstractShapeBuilder<B extends software.amazon.smithy.model.shapes.NamedMembersShapeBuilder<B,
S>, S extends Shape> - Returns:
- Returns the updated builder.
-