B - Concrete builder type.S - Shape being created.public abstract class AbstractShapeBuilder<B extends AbstractShapeBuilder<?,?>,S extends Shape> extends java.lang.Object implements SmithyBuilder<S>, FromSourceLocation
Shapes.| Modifier and Type | Method and Description |
|---|---|
B |
addMember(MemberShape member)
Adds a member to the shape IFF the shape supports members.
|
B |
addTrait(Trait trait)
Adds a trait to the shape builder, replacing any conflicting traits.
|
B |
addTraits(java.util.Collection<Trait> traitsToAdd)
Adds traits from an iterator to the shape builder, replacing any
conflicting traits.
|
B |
clearTraits()
Removes all traits.
|
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 |
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, waitbuild, requiredStatepublic SourceLocation getSourceLocation()
FromSourceLocationgetSourceLocation in interface FromSourceLocationpublic abstract ShapeType getShapeType()
public ShapeId getId()
public B id(ShapeId shapeId)
shapeId - Shape ID to set.public final B id(java.lang.String shapeId)
shapeId - Absolute shape ID string to set.ShapeIdSyntaxException - if the shape ID is invalid.public final B source(SourceLocation sourceLocation)
sourceLocation - Source location to set.public final 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 final B traits(java.util.Collection<Trait> traitsToSet)
traitsToSet - Sequence of traits to set on the builder.public final B addTraits(java.util.Collection<Trait> traitsToAdd)
traitsToAdd - Sequence of traits to add to the builder.public final B addTrait(Trait trait)
trait - Trait instance to add.public final 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 final B removeTrait(ShapeId traitId)
traitId - ID of the trait to remove.public final B clearTraits()
public B addMember(MemberShape member)
member - Member to add to the shape.java.lang.UnsupportedOperationException - if the shape does not support members.