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 class
TraitDefinition.BreakingChangeRule
Represents an individual trait diff rule to define backward compatibility rules.static class
TraitDefinition.Builder
Builder to create a TraitDefinition.static class
TraitDefinition.ChangeType
static class
TraitDefinition.Provider
static class
TraitDefinition.StructurallyExclusive
The structural exclusion semantics of the trait.
-
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.Builder
builder()
protected Node
createNode()
The result of toNode is used for hashCodes and equality.boolean
equals(java.lang.Object other)
java.util.List<TraitDefinition.BreakingChangeRule>
getBreakingChanges()
java.util.List<ShapeId>
getConflicts()
Gets the trait names that conflict with this trait.Selector
getSelector()
Gets the valid places in a model that this trait can be applied.java.util.Optional<TraitDefinition.StructurallyExclusive>
getStructurallyExclusive()
Gets thestructurallyExclusive
property of the trait.int
hashCode()
boolean
isStructurallyExclusiveByMember()
boolean
isStructurallyExclusiveByTarget()
TraitDefinition.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.AbstractTrait
getSourceLocation, setNodeCache, toNode, toShapeId, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.smithy.model.traits.Trait
isSynthetic
-
-
-
-
Field Detail
-
ID
public static final ShapeId ID
-
-
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:ToSmithyBuilder
Take this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilder
in 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 thestructurallyExclusive
property of the trait.- Returns:
- Returns the
structurallyExclusive
property of the trait.
-
isStructurallyExclusiveByMember
public boolean isStructurallyExclusiveByMember()
- Returns:
- Returns true if the trait is
structurallyExclusive
by member.
-
isStructurallyExclusiveByTarget
public boolean isStructurallyExclusiveByTarget()
- Returns:
- Returns true if the trait is
structurallyExclusive
by target.
-
getBreakingChanges
public java.util.List<TraitDefinition.BreakingChangeRule> getBreakingChanges()
- Returns:
- Returns the breaking change rules of the trait.
-
createNode
protected Node createNode()
Description copied from class:AbstractTrait
The 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:
createNode
in classAbstractTrait
- Returns:
- Returns the trait as a node.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classAbstractTrait
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractTrait
-
-