Class SyntheticEnumTrait
- java.lang.Object
-
- software.amazon.smithy.model.traits.AbstractTrait
-
- software.amazon.smithy.model.traits.EnumTrait
-
- software.amazon.smithy.model.traits.synthetic.SyntheticEnumTrait
-
- All Implemented Interfaces:
FromSourceLocation
,ToNode
,ToShapeId
,Trait
,ToSmithyBuilder<EnumTrait>
public final class SyntheticEnumTrait extends EnumTrait
A synthetic copy of theEnumTrait
for use in theEnumShape
. This exists only to bridge compatibility between IDL 1.0 and 2.0. This synthetic trait will be applied to enum shapes so that code generators can treat enum shapes as string shapes with the enum trait. We set synthetic to true so that it won't get serialized. We change the shape id so that it doesn't trip up selector validation for the enum trait, which does not allow targeting enum shapes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SyntheticEnumTrait.Builder
-
Nested classes/interfaces inherited from class software.amazon.smithy.model.traits.EnumTrait
EnumTrait.Provider
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SyntheticEnumTrait.Builder
builder()
boolean
isSynthetic()
Checks if this trait is persisted with the shape, or if it is a synthetic, or transient trait, only meant to temporarily aid in some kind of in-memory model transformation.SyntheticEnumTrait.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.traits.EnumTrait
createNode, getEnumDefinitionValues, getValues, hasNames
-
Methods inherited from class software.amazon.smithy.model.traits.AbstractTrait
equals, getSourceLocation, hashCode, setNodeCache, toNode, toShapeId, toString
-
-
-
-
Field Detail
-
ID
public static final ShapeId ID
-
-
Method Detail
-
isSynthetic
public boolean isSynthetic()
Description copied from interface:Trait
Checks if this trait is persisted with the shape, or if it is a synthetic, or transient trait, only meant to temporarily aid in some kind of in-memory model transformation.Because synthetic traits are not persisted with shapes, they also do not need to be defined in Smithy's semantic model before they can be used in the model.
- Returns:
- Returns true if the trait is not persisted on the shape.
-
toBuilder
public SyntheticEnumTrait.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<EnumTrait>
- Overrides:
toBuilder
in classEnumTrait
- Returns:
- a builder for type T
-
builder
public static SyntheticEnumTrait.Builder builder()
- Returns:
- Returns a synthetic enum trait builder.
-
-