Class MapShape.Builder
- java.lang.Object
-
- software.amazon.smithy.model.shapes.AbstractShapeBuilder<MapShape.Builder,MapShape>
-
- software.amazon.smithy.model.shapes.MapShape.Builder
-
- All Implemented Interfaces:
FromSourceLocation
,SmithyBuilder<MapShape>
- Enclosing class:
- MapShape
public static final class MapShape.Builder extends AbstractShapeBuilder<MapShape.Builder,MapShape>
Builder used to create aListShape
.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MapShape.Builder
addMember(MemberShape member)
Adds a member to the shape IFF the shape supports members.MapShape
build()
Creates an immutable object that is created from the properties that have been set on the builder.MapShape.Builder
clearMembers()
Removes all members from the builder.MapShape.Builder
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.MapShape.Builder
id(ShapeId shapeId)
Sets the shape ID of the shape.MapShape.Builder
key(MemberShape member)
MapShape.Builder
key(ShapeId target)
Sets the key member of the map.MapShape.Builder
key(ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Sets the key member of the map.MapShape.Builder
value(MemberShape member)
MapShape.Builder
value(ShapeId target)
Sets the value member of the map.MapShape.Builder
value(ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Sets the value member of the map.-
Methods inherited from class software.amazon.smithy.model.shapes.AbstractShapeBuilder
addMixin, addTrait, addTraits, clearMixins, clearTraits, getAllTraits, getId, getSourceLocation, id, mixins, removeMixin, removeTrait, removeTrait, source, source, traits
-
-
-
-
Method Detail
-
build
public MapShape 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<MapShape.Builder,MapShape>
- Returns:
- Returns the shape type.
-
getMember
public java.util.Optional<MemberShape> getMember(java.lang.String memberName)
Description copied from class:AbstractShapeBuilder
Gets the optional member with the given name.- Overrides:
getMember
in classAbstractShapeBuilder<MapShape.Builder,MapShape>
- Returns:
- Returns the optional member with the given name.
-
id
public MapShape.Builder id(ShapeId shapeId)
Description copied from class:AbstractShapeBuilder
Sets the shape ID of the shape.- Overrides:
id
in classAbstractShapeBuilder<MapShape.Builder,MapShape>
- Parameters:
shapeId
- Shape ID to set.- Returns:
- Returns the builder.
-
key
public MapShape.Builder key(MemberShape member)
-
value
public MapShape.Builder value(MemberShape member)
-
addMember
public MapShape.Builder addMember(MemberShape member)
Description copied from class:AbstractShapeBuilder
Adds a member to the shape IFF the shape supports members.- Overrides:
addMember
in classAbstractShapeBuilder<MapShape.Builder,MapShape>
- Parameters:
member
- Member to add to the shape.- Returns:
- Returns the builder.
-
clearMembers
public MapShape.Builder clearMembers()
Description copied from class:AbstractShapeBuilder
Removes all members from the builder.- Overrides:
clearMembers
in classAbstractShapeBuilder<MapShape.Builder,MapShape>
- Returns:
- Returns the builder.
-
key
public MapShape.Builder key(ShapeId target)
Sets the key member of the map.- Parameters:
target
- Target of the member.- Returns:
- Returns the builder.
-
key
public MapShape.Builder key(ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Sets the key member of the map.- Parameters:
target
- Target of the member.memberUpdater
- Consumer that can update the created member shape.- Returns:
- Returns the builder.
-
value
public MapShape.Builder value(ShapeId target)
Sets the value member of the map.- Parameters:
target
- Target of the member.- Returns:
- Returns the builder.
-
value
public MapShape.Builder value(ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Sets the value member of the map.- Parameters:
target
- Target of the member.memberUpdater
- Consumer that can updated the created member shape.- Returns:
- Returns the builder.
-
flattenMixins
public MapShape.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<MapShape.Builder,MapShape>
- Returns:
- Returns the updated builder.
-
-