public final class EnumShape extends StringShape
| Modifier and Type | Class and Description |
|---|---|
static class |
EnumShape.Builder |
| Modifier and Type | Method and Description |
|---|---|
<R> R |
accept(ShapeVisitor<R> cases)
Dispatches the shape to the appropriate
ShapeVisitor method. |
java.util.Optional<EnumShape> |
asEnumShape() |
static EnumShape.Builder |
builder() |
static boolean |
canConvertToEnum(StringShape shape,
boolean synthesizeEnumNames)
Determines whether a given string shape can be converted to an enum shape.
|
java.util.Optional<Trait> |
findTrait(ShapeId id)
Attempts to find a trait applied to the shape by name.
|
static java.util.Optional<EnumShape> |
fromStringShape(StringShape shape)
Converts a base
StringShape to an EnumShape if possible. |
static java.util.Optional<EnumShape> |
fromStringShape(StringShape shape,
boolean synthesizeNames)
Converts a base
StringShape to an EnumShape if possible. |
java.util.Map<java.lang.String,MemberShape> |
getAllMembers()
Gets the members of the shape, including mixin members.
|
java.util.Map<java.lang.String,java.lang.String> |
getEnumValues()
Gets a map of enum member names to their corresponding values.
|
ShapeType |
getType()
Gets the type of the shape.
|
EnumShape.Builder |
toBuilder() |
asStringShapeasBigDecimalShape, 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, validateMixinsclone, finalize, getClass, notify, notifyAll, wait, wait, waitcomparepublic java.util.Map<java.lang.String,java.lang.String> getEnumValues()
public java.util.Map<java.lang.String,MemberShape> getAllMembers()
getAllMembers in class Shapepublic java.util.Optional<Trait> findTrait(ShapeId id)
Shapepublic static EnumShape.Builder builder()
public EnumShape.Builder toBuilder()
toBuilder in interface software.amazon.smithy.utils.ToSmithyBuilder<StringShape>toBuilder in class StringShapepublic <R> R accept(ShapeVisitor<R> cases)
ShapeShapeVisitor method.accept in class StringShapeR - Return type of the accept.cases - ShapeVisitor to use.public java.util.Optional<EnumShape> asEnumShape()
asEnumShape in class ShapeEnumShape.public static java.util.Optional<EnumShape> fromStringShape(StringShape shape, boolean synthesizeNames)
StringShape to an EnumShape if possible.
The result will be empty if the given shape doesn't have the EnumTrait,
if the enum doesn't have names and name synthesization is disabled, or if a name
cannot be synthesized.shape - A base StringShape to convert.synthesizeNames - Whether names should be synthesized if possible.EnumShape equivalent of the given shape.public static java.util.Optional<EnumShape> fromStringShape(StringShape shape)
StringShape to an EnumShape if possible.
The result will be empty if the given shape doesn't have the EnumTrait
or if the enum definitions don't have names.shape - A base StringShape to convert.EnumShape equivalent of the given shape.public static boolean canConvertToEnum(StringShape shape, boolean synthesizeEnumNames)
shape - The string shape to be converted.synthesizeEnumNames - Whether synthesizing enum names should be accounted for.public ShapeType getType()
ShapegetType in class StringShape