Class MemberShape
- java.lang.Object
-
- software.amazon.smithy.model.shapes.Shape
-
- software.amazon.smithy.model.shapes.MemberShape
-
- All Implemented Interfaces:
java.lang.Comparable<Shape>
,FromSourceLocation
,ToShapeId
,Tagged
,ToSmithyBuilder<MemberShape>
public final class MemberShape extends Shape implements ToSmithyBuilder<MemberShape>
Represents a member that targets another shape by ID.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MemberShape.Builder
Builder used to create aMemberShape
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> R
accept(ShapeVisitor<R> visitor)
Dispatches the shape to the appropriateShapeVisitor
method.java.util.Optional<MemberShape>
asMemberShape()
static MemberShape.Builder
builder()
boolean
equals(java.lang.Object other)
java.util.Optional<Trait>
findMemberTrait(Model model, java.lang.String traitName)
Gets a trait from the member shape or from the shape targeted by the member.ShapeId
getContainer()
Gets the shape in which the member is contained.java.lang.String
getMemberName()
Get the member name of the member.<T extends Trait>
java.util.Optional<T>getMemberTrait(Model model, java.lang.Class<T> trait)
Gets a trait from the member shape or from the shape targeted by the member.ShapeId
getTarget()
Get the targeted member shape ID.ShapeType
getType()
Gets the type of the shape.boolean
hasNonNullDefault()
boolean
hasNullDefault()
boolean
isOptional()
boolean
isRequired()
MemberShape.Builder
toBuilder()
Take this object and create a builder that contains all of the current property values of this object.-
Methods inherited from class software.amazon.smithy.model.shapes.Shape
asBigDecimalShape, asBigIntegerShape, asBlobShape, asBooleanShape, asByteShape, asDocumentShape, asDoubleShape, asEnumShape, asFloatShape, asIntegerShape, asIntEnumShape, asListShape, asLongShape, asMapShape, asOperationShape, asResourceShape, asServiceShape, asSetShape, asShortShape, asStringShape, asStructureShape, asTimestampShape, asUnionShape, compareTo, expectTrait, findTrait, findTrait, getAllMembers, getAllTraits, getId, getIntroducedTraits, getMember, getMemberNames, getMixins, getRequiredMembers, getSourceLocation, getTags, getTrait, hashCode, hasTrait, hasTrait, hasTrait, isBigDecimalShape, isBigIntegerShape, isBlobShape, isBooleanShape, isByteShape, isDocumentShape, isDoubleShape, isEnumShape, isFloatShape, isIntegerShape, isIntEnumShape, isListShape, isLongShape, isMapShape, isMemberShape, isOperationShape, isResourceShape, isServiceShape, isSetShape, isShortShape, isStringShape, isStructureShape, isTimestampShape, isUnionShape, members, shapeToBuilder, toShapeId, toString, validateMemberShapeIds, validateMixins
-
-
-
-
Method Detail
-
builder
public static MemberShape.Builder builder()
-
toBuilder
public MemberShape.Builder toBuilder()
Description copied from interface:ToSmithyBuilder
Take this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilder
in interfaceToSmithyBuilder<MemberShape>
- Returns:
- a builder for type T
-
getContainer
public ShapeId getContainer()
Gets the shape in which the member is contained.- Returns:
- Returns the containing shape id.
-
accept
public <R> R accept(ShapeVisitor<R> visitor)
Description copied from class:Shape
Dispatches the shape to the appropriateShapeVisitor
method.
-
asMemberShape
public java.util.Optional<MemberShape> asMemberShape()
- Overrides:
asMemberShape
in classShape
- Returns:
- Optionally returns the shape as a
MemberShape
.
-
getTarget
public ShapeId getTarget()
Get the targeted member shape ID.- Returns:
- Returns the member shape ID.
-
getMemberName
public java.lang.String getMemberName()
Get the member name of the member.- Returns:
- Returns the member name.
-
isRequired
public boolean isRequired()
- Returns:
- Returns true if the member has the required trait.
-
isOptional
public boolean isOptional()
- Returns:
- Returns true if the member is not required.
-
hasNullDefault
public boolean hasNullDefault()
- Returns:
- Returns true if the member has a default set explicitly to null.
-
hasNonNullDefault
public boolean hasNonNullDefault()
- Returns:
- Returns true if the member has a default not set to null.
-
getMemberTrait
public <T extends Trait> java.util.Optional<T> getMemberTrait(Model model, java.lang.Class<T> trait)
Description copied from class:Shape
Gets a trait from the member shape or from the shape targeted by the member.If the shape is not a member, then the method functions the same as
Shape.getTrait(Class)
.- Overrides:
getMemberTrait
in classShape
- Type Parameters:
T
- Trait type to get.- Parameters:
model
- Model used to find member targets.trait
- Trait type to get.- Returns:
- Returns the optionally found trait on the shape or member.
- See Also:
Shape.getTrait(Class)
-
findMemberTrait
public java.util.Optional<Trait> findMemberTrait(Model model, java.lang.String traitName)
Description copied from class:Shape
Gets a trait from the member shape or from the shape targeted by the member.If the shape is not a member, then the method functions the same as
Shape.findTrait(String)
.- Overrides:
findMemberTrait
in classShape
- Parameters:
model
- Model used to find member targets.traitName
- Trait name to get.- Returns:
- Returns the optionally found trait on the shape or member.
- See Also:
Shape.findTrait(String)
-
-