Class SetShape.Builder
- java.lang.Object
-
- software.amazon.smithy.model.shapes.AbstractShapeBuilder<B,S>
-
- software.amazon.smithy.model.shapes.CollectionShape.Builder<ListShape.Builder,ListShape>
-
- software.amazon.smithy.model.shapes.ListShape.Builder
-
- software.amazon.smithy.model.shapes.SetShape.Builder
-
- All Implemented Interfaces:
FromSourceLocation
,SmithyBuilder<ListShape>
- Enclosing class:
- SetShape
public static final class SetShape.Builder extends ListShape.Builder
Builder used to create aSetShape
.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SetShape.Builder
addMember(MemberShape member)
Adds a member to the shape IFF the shape supports members.SetShape.Builder
addTrait(Trait trait)
Adds a trait to the shape builder, replacing any conflicting traits.SetShape.Builder
addTraits(java.util.Collection<? extends Trait> traitsToAdd)
Adds traits from an iterator to the shape builder, replacing any conflicting traits.SetShape
build()
Creates an immutable object that is created from the properties that have been set on the builder.SetShape.Builder
clearMembers()
Removes all members from the builder.SetShape.Builder
clearTraits()
Removes all traits.ShapeType
getShapeType()
Gets the type of shape being built.SetShape.Builder
id(java.lang.String shapeId)
Sets the shape ID of the shape.SetShape.Builder
id(ShapeId shapeId)
Sets the shape ID of the shape.SetShape.Builder
member(MemberShape member)
Sets the member of the collection.SetShape.Builder
member(ShapeId target)
Sets the member of the collection.SetShape.Builder
member(ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Sets the member of the collection.SetShape.Builder
removeTrait(java.lang.String traitId)
Removes a trait from the shape builder.SetShape.Builder
removeTrait(ShapeId traitId)
Removes a trait from the shape builder.SetShape.Builder
source(java.lang.String filename, int line, int column)
Sets the source location of the shape.SetShape.Builder
source(SourceLocation sourceLocation)
Sets the source location of the shape.SetShape.Builder
traits(java.util.Collection<Trait> traitsToSet)
Replace all traits in the builder.-
Methods inherited from class software.amazon.smithy.model.shapes.CollectionShape.Builder
flattenMixins, getMember
-
Methods inherited from class software.amazon.smithy.model.shapes.AbstractShapeBuilder
addMixin, clearMixins, getAllTraits, getId, getSourceLocation, mixins, removeMixin
-
-
-
-
Method Detail
-
build
public SetShape build()
Description copied from interface:SmithyBuilder
Creates an immutable object that is created from the properties that have been set on the builder.- Specified by:
build
in interfaceSmithyBuilder<ListShape>
- Overrides:
build
in classListShape.Builder
- Returns:
- an instance of T
-
getShapeType
public ShapeType getShapeType()
Description copied from class:AbstractShapeBuilder
Gets the type of shape being built.- Overrides:
getShapeType
in classListShape.Builder
- Returns:
- Returns the shape type.
-
member
public SetShape.Builder member(MemberShape member)
Description copied from class:CollectionShape.Builder
Sets the member of the collection.- Overrides:
member
in classCollectionShape.Builder<ListShape.Builder,ListShape>
- Parameters:
member
- Member of the collection to set.- Returns:
- Returns the builder.
-
member
public SetShape.Builder member(ShapeId target)
Description copied from class:CollectionShape.Builder
Sets the member of the collection.- Overrides:
member
in classCollectionShape.Builder<ListShape.Builder,ListShape>
- Parameters:
target
- Target of the member.- Returns:
- Returns the builder.
-
member
public SetShape.Builder member(ShapeId target, java.util.function.Consumer<MemberShape.Builder> memberUpdater)
Description copied from class:CollectionShape.Builder
Sets the member of the collection.- Overrides:
member
in classCollectionShape.Builder<ListShape.Builder,ListShape>
- Parameters:
target
- Target of the member.memberUpdater
- Consumer that can update the created member shape.- Returns:
- Returns the builder.
-
id
public SetShape.Builder id(ShapeId shapeId)
Description copied from class:AbstractShapeBuilder
Sets the shape ID of the shape.- Overrides:
id
in classCollectionShape.Builder<ListShape.Builder,ListShape>
- Parameters:
shapeId
- Shape ID to set.- Returns:
- Returns the builder.
-
addMember
public SetShape.Builder addMember(MemberShape member)
Description copied from class:AbstractShapeBuilder
Adds a member to the shape IFF the shape supports members.- Overrides:
addMember
in classCollectionShape.Builder<ListShape.Builder,ListShape>
- Parameters:
member
- Member to add to the shape.- Returns:
- Returns the builder.
-
clearMembers
public SetShape.Builder clearMembers()
Description copied from class:AbstractShapeBuilder
Removes all members from the builder.- Overrides:
clearMembers
in classCollectionShape.Builder<ListShape.Builder,ListShape>
- Returns:
- Returns the builder.
-
id
public SetShape.Builder id(java.lang.String shapeId)
Description copied from class:AbstractShapeBuilder
Sets the shape ID of the shape.- Overrides:
id
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Parameters:
shapeId
- Absolute shape ID string to set.- Returns:
- Returns the builder.
-
source
public SetShape.Builder source(SourceLocation sourceLocation)
Description copied from class:AbstractShapeBuilder
Sets the source location of the shape.- Overrides:
source
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Parameters:
sourceLocation
- Source location to set.- Returns:
- Returns the builder.
-
source
public SetShape.Builder source(java.lang.String filename, int line, int column)
Description copied from class:AbstractShapeBuilder
Sets the source location of the shape.- Overrides:
source
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Parameters:
filename
- Name of the file in which the shape was defined.line
- Line number in the file where the shape was defined.column
- Column number of the line where the shape was defined.- Returns:
- Returns the builder.
-
traits
public SetShape.Builder traits(java.util.Collection<Trait> traitsToSet)
Description copied from class:AbstractShapeBuilder
Replace all traits in the builder.- Overrides:
traits
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Parameters:
traitsToSet
- Sequence of traits to set on the builder.- Returns:
- Returns the builder.
-
addTraits
public SetShape.Builder addTraits(java.util.Collection<? extends Trait> traitsToAdd)
Description copied from class:AbstractShapeBuilder
Adds traits from an iterator to the shape builder, replacing any conflicting traits.- Overrides:
addTraits
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Parameters:
traitsToAdd
- Sequence of traits to add to the builder.- Returns:
- Returns the builder.
-
addTrait
public SetShape.Builder addTrait(Trait trait)
Description copied from class:AbstractShapeBuilder
Adds a trait to the shape builder, replacing any conflicting traits.- Overrides:
addTrait
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Parameters:
trait
- Trait instance to add.- Returns:
- Returns the builder.
-
removeTrait
public SetShape.Builder removeTrait(java.lang.String traitId)
Description copied from class:AbstractShapeBuilder
Removes a trait from the shape builder.A relative trait name will attempt to remove a prelude trait with the given name.
- Overrides:
removeTrait
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Parameters:
traitId
- Absolute or relative ID of the trait to remove.- Returns:
- Returns the builder.
-
removeTrait
public SetShape.Builder removeTrait(ShapeId traitId)
Description copied from class:AbstractShapeBuilder
Removes a trait from the shape builder.- Overrides:
removeTrait
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Parameters:
traitId
- ID of the trait to remove.- Returns:
- Returns the builder.
-
clearTraits
public SetShape.Builder clearTraits()
Description copied from class:AbstractShapeBuilder
Removes all traits.- Overrides:
clearTraits
in classAbstractShapeBuilder<ListShape.Builder,ListShape>
- Returns:
- Returns the builder.
-
-