B
- Concrete builder type.S
- Shape being created.public abstract class AbstractShapeBuilder<B extends AbstractShapeBuilder<B,S>,S extends Shape> extends java.lang.Object implements software.amazon.smithy.utils.SmithyBuilder<S>, FromSourceLocation
Shape
s.Modifier and Type | Method and Description |
---|---|
B |
addMember(MemberShape member)
Adds a member to the shape IFF the shape supports members.
|
B |
addMixin(Shape shape)
Adds a mixin to the shape.
|
B |
addTrait(Trait trait)
Adds a trait to the shape builder, replacing any conflicting traits.
|
B |
addTraits(java.util.Collection<? extends Trait> traitsToAdd)
Adds traits from an iterator to the shape builder, replacing any
conflicting traits.
|
B |
clearMembers()
Removes all members from the builder.
|
B |
clearMixins()
Removes all mixins.
|
B |
clearTraits()
Removes all traits.
|
B |
flattenMixins()
Removes mixins from a shape and flattens them into the shape.
|
java.util.Map<ShapeId,Trait> |
getAllTraits()
Get an immutable view of the traits applied to the builder.
|
ShapeId |
getId()
Gets the shape ID of the builder.
|
abstract ShapeType |
getShapeType()
Gets the type of shape being built.
|
SourceLocation |
getSourceLocation()
Gets the source location of a value.
|
B |
id(ShapeId shapeId)
Sets the shape ID of the shape.
|
B |
id(java.lang.String shapeId)
Sets the shape ID of the shape.
|
B |
mixins(java.util.Collection<? extends Shape> mixins)
Replaces the mixins of the shape.
|
B |
removeMixin(ToShapeId shape)
Removes a mixin from the shape by shape or ID.
|
B |
removeTrait(ShapeId traitId)
Removes a trait from the shape builder.
|
B |
removeTrait(java.lang.String traitId)
Removes a trait from the shape builder.
|
B |
source(SourceLocation sourceLocation)
Sets the source location of the shape.
|
B |
source(java.lang.String filename,
int line,
int column)
Sets the source location of the shape.
|
B |
traits(java.util.Collection<Trait> traitsToSet)
Replace all traits in the builder.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compare
public SourceLocation getSourceLocation()
FromSourceLocation
getSourceLocation
in interface FromSourceLocation
public abstract ShapeType getShapeType()
public ShapeId getId()
public B id(ShapeId shapeId)
shapeId
- Shape ID to set.public B id(java.lang.String shapeId)
shapeId
- Absolute shape ID string to set.ShapeIdSyntaxException
- if the shape ID is invalid.public B source(SourceLocation sourceLocation)
sourceLocation
- Source location to set.public B source(java.lang.String filename, int line, int column)
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.public B traits(java.util.Collection<Trait> traitsToSet)
traitsToSet
- Sequence of traits to set on the builder.public java.util.Map<ShapeId,Trait> getAllTraits()
public B addTraits(java.util.Collection<? extends Trait> traitsToAdd)
traitsToAdd
- Sequence of traits to add to the builder.public B addTrait(Trait trait)
trait
- Trait instance to add.public B removeTrait(java.lang.String traitId)
A relative trait name will attempt to remove a prelude trait with the given name.
traitId
- Absolute or relative ID of the trait to remove.public B removeTrait(ShapeId traitId)
traitId
- ID of the trait to remove.public B clearTraits()
public B addMember(MemberShape member)
member
- Member to add to the shape.java.lang.UnsupportedOperationException
- if the shape does not support members.public B clearMembers()
public B addMixin(Shape shape)
shape
- Mixin to add.public B mixins(java.util.Collection<? extends Shape> mixins)
mixins
- Mixins to add.public B removeMixin(ToShapeId shape)
shape
- Shape or shape ID to remove.public B clearMixins()
public B flattenMixins()
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.