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 classMemberShape.BuilderBuilder used to create aMemberShape.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> Raccept(ShapeVisitor<R> visitor)Dispatches the shape to the appropriateShapeVisitormethod.java.util.Optional<MemberShape>asMemberShape()static MemberShape.Builderbuilder()booleanequals(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.ShapeIdgetContainer()Gets the shape in which the member is contained.java.lang.StringgetMemberName()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.ShapeIdgetTarget()Get the targeted member shape ID.ShapeTypegetType()Gets the type of the shape.booleanisOptional()booleanisRequired()MemberShape.BuildertoBuilder()Take this object and create a builder that contains all of the current property values of this object.protected voidvalidateMixins(java.util.Map<ShapeId,Shape> mixins, java.util.Map<ShapeId,Trait> introducedTraits)-
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, getRequiredMixinMember, 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
-
-
-
-
Method Detail
-
validateMixins
protected void validateMixins(java.util.Map<ShapeId,Shape> mixins, java.util.Map<ShapeId,Trait> introducedTraits)
- Overrides:
validateMixinsin classShape
-
builder
public static MemberShape.Builder builder()
-
toBuilder
public MemberShape.Builder toBuilder()
Description copied from interface:ToSmithyBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilderin 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:ShapeDispatches the shape to the appropriateShapeVisitormethod.
-
asMemberShape
public java.util.Optional<MemberShape> asMemberShape()
- Overrides:
asMemberShapein 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.
-
getMemberTrait
public <T extends Trait> java.util.Optional<T> getMemberTrait(Model model, java.lang.Class<T> trait)
Description copied from class:ShapeGets 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:
getMemberTraitin 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:ShapeGets 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:
findMemberTraitin 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)
-
-