Class EnumShape
java.lang.Object
software.amazon.smithy.model.shapes.Shape
software.amazon.smithy.model.shapes.SimpleShape
software.amazon.smithy.model.shapes.StringShape
software.amazon.smithy.model.shapes.EnumShape
- All Implemented Interfaces:
Comparable<Shape>,FromSourceLocation,ToShapeId,Tagged,ToSmithyBuilder<StringShape>
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(ShapeVisitor<R> cases) Dispatches the shape to the appropriateShapeVisitormethod.static EnumShape.Builderbuilder()static booleancanConvertToEnum(StringShape shape, boolean synthesizeEnumNames) Determines whether a given string shape can be converted to an enum shape.Attempts to find a trait applied to the shape by name.fromStringShape(StringShape shape) Converts a baseStringShapeto anEnumShapeif possible.fromStringShape(StringShape shape, boolean synthesizeNames) Converts a baseStringShapeto anEnumShapeif possible.Gets the members of the shape, including mixin members.Gets a map of enum member names to their corresponding values.getType()Gets the type of the shape.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.StringShape
asStringShapeMethods inherited from class software.amazon.smithy.model.shapes.Shape
asBigDecimalShape, asBigIntegerShape, asBlobShape, asBooleanShape, asByteShape, asDocumentShape, asDoubleShape, asFloatShape, asIntegerShape, asIntEnumShape, asListShape, asLongShape, asMapShape, asMemberShape, asOperationShape, asResourceShape, asServiceShape, asSetShape, asShortShape, asStructureShape, asTimestampShape, asUnionShape, compareTo, equals, expectTrait, findMemberTrait, findTrait, getAllTraits, getId, getIntroducedTraits, getMember, getMemberNames, getMemberTrait, 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 Details
-
getEnumValues
Gets a map of enum member names to their corresponding values.- Returns:
- A map of member names to enum values.
-
getAllMembers
Gets the members of the shape, including mixin members.- Overrides:
getAllMembersin classShape- Returns:
- Returns the immutable member map.
-
findTrait
Description copied from class:ShapeAttempts to find a trait applied to the shape by name. -
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<StringShape>- Overrides:
toBuilderin classStringShape- Returns:
- a builder for type T
-
accept
Description copied from class:ShapeDispatches the shape to the appropriateShapeVisitormethod.- Overrides:
acceptin classStringShape- Type Parameters:
R- Return type of the accept.- Parameters:
cases- ShapeVisitor to use.- Returns:
- Returns the result.
-
asEnumShape
- Overrides:
asEnumShapein classShape- Returns:
- Optionally returns the shape as a
EnumShape.
-
fromStringShape
Converts a baseStringShapeto anEnumShapeif possible. The result will be empty if the given shape doesn't have theEnumTrait, if the enum doesn't have names and name synthesization is disabled, or if a name cannot be synthesized.- Parameters:
shape- A baseStringShapeto convert.synthesizeNames- Whether names should be synthesized if possible.- Returns:
- Optionally returns an
EnumShapeequivalent of the given shape.
-
fromStringShape
Converts a baseStringShapeto anEnumShapeif possible. The result will be empty if the given shape doesn't have theEnumTraitor if the enum definitions don't have names.- Parameters:
shape- A baseStringShapeto convert.- Returns:
- Optionally returns an
EnumShapeequivalent of the given shape.
-
canConvertToEnum
Determines whether a given string shape can be converted to an enum shape.- Parameters:
shape- The string shape to be converted.synthesizeEnumNames- Whether synthesizing enum names should be accounted for.- Returns:
- Returns true if the string shape can be converted to an enum shape.
-
getType
Description copied from class:ShapeGets the type of the shape.- Overrides:
getTypein classStringShape- Returns:
- Returns the type;
-