Class TraitDefinition
- java.lang.Object
-
- software.amazon.smithy.model.traits.AbstractTrait
-
- software.amazon.smithy.model.traits.TraitDefinition
-
- All Implemented Interfaces:
FromSourceLocation,ToNode,ToShapeId,Trait,ToSmithyBuilder<TraitDefinition>
public final class TraitDefinition extends AbstractTrait implements ToSmithyBuilder<TraitDefinition>
Trait definition trait.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTraitDefinition.BuilderBuilder to create a TraitDefinition.static classTraitDefinition.Providerstatic classTraitDefinition.StructurallyExclusiveThe structural exclusion semantics of the trait.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONFLICTS_KEYstatic ShapeIdIDstatic java.lang.StringSELECTOR_KEYstatic java.lang.StringSTRUCTURALLY_EXCLUSIVE_KEY
-
Constructor Summary
Constructors Constructor Description TraitDefinition(TraitDefinition.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TraitDefinition.Builderbuilder()protected NodecreateNode()The result of toNode is used for hashCodes and equality.java.util.List<ShapeId>getConflicts()Gets the trait names that conflict with this trait.SelectorgetSelector()Gets the valid places in a model that this trait can be applied.java.util.Optional<TraitDefinition.StructurallyExclusive>getStructurallyExclusive()Gets thestructurallyExclusiveproperty of the trait.booleanisStructurallyExclusiveByMember()booleanisStructurallyExclusiveByTarget()TraitDefinition.BuildertoBuilder()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.AbstractTrait
equals, getSourceLocation, hashCode, toNode, toShapeId, toString
-
-
-
-
Field Detail
-
ID
public static final ShapeId ID
-
SELECTOR_KEY
public static final java.lang.String SELECTOR_KEY
- See Also:
- Constant Field Values
-
STRUCTURALLY_EXCLUSIVE_KEY
public static final java.lang.String STRUCTURALLY_EXCLUSIVE_KEY
- See Also:
- Constant Field Values
-
CONFLICTS_KEY
public static final java.lang.String CONFLICTS_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TraitDefinition
public TraitDefinition(TraitDefinition.Builder builder)
-
-
Method Detail
-
builder
public static TraitDefinition.Builder builder()
-
toBuilder
public TraitDefinition.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<TraitDefinition>- Returns:
- a builder for type T
-
getSelector
public Selector getSelector()
Gets the valid places in a model that this trait can be applied.- Returns:
- Returns the trait selector.
-
getConflicts
public java.util.List<ShapeId> getConflicts()
Gets the trait names that conflict with this trait.- Returns:
- Returns the conflicting trait names.
-
getStructurallyExclusive
public java.util.Optional<TraitDefinition.StructurallyExclusive> getStructurallyExclusive()
Gets thestructurallyExclusiveproperty of the trait.- Returns:
- Returns the
structurallyExclusiveproperty of the trait.
-
isStructurallyExclusiveByMember
public boolean isStructurallyExclusiveByMember()
- Returns:
- Returns true if the trait is
structurallyExclusiveby member.
-
isStructurallyExclusiveByTarget
public boolean isStructurallyExclusiveByTarget()
- Returns:
- Returns true if the trait is
structurallyExclusiveby target.
-
createNode
protected Node createNode()
Description copied from class:AbstractTraitThe result of toNode is used for hashCodes and equality. Subclasses must implement createNode to turn the trait into a Node. This is then cached for subsequent retrievals.- Specified by:
createNodein classAbstractTrait- Returns:
- Returns the trait as a node.
-
-