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.
  • Field Details

    • ID

      public static final ShapeId ID
  • Constructor Details

  • Method Details

    • 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 interface ToSmithyBuilder<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 List<ShapeId> getConflicts()
      Gets the trait names that conflict with this trait.
      Returns:
      Returns the conflicting trait names.
    • getStructurallyExclusive

      public Optional<TraitDefinition.StructurallyExclusive> getStructurallyExclusive()
      Gets the structurallyExclusive 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 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 class AbstractTrait
      Returns:
      Returns the trait as a node.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class AbstractTrait
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractTrait