Class IdRefTrait

All Implemented Interfaces:
FromSourceLocation, ToNode, ToShapeId, Trait, ToSmithyBuilder<IdRefTrait>

public final class IdRefTrait extends AbstractTrait implements ToSmithyBuilder<IdRefTrait>
Indicates that a string value must contain a valid shape ID.

failWhenMissing can be set to true to fail when the shape ID contained in a string shape cannot be found in the result set of the selector property. failWhenMissing defaults to false when not set.

The selector property is used to query the model for all shapes that match a shape selector. The value contained within the string shape targeted by this trait MUST match one of the shapes returns by the shape selector if failWhenMissing is set to true. selector defaults to "*" when not set.

  • Field Details

    • ID

      public static final ShapeId ID
  • Method Details

    • getSelector

      public Selector getSelector()
    • failWhenMissing

      public boolean failWhenMissing()
    • getErrorMessage

      public Optional<String> getErrorMessage()
    • toBuilder

      public IdRefTrait.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<IdRefTrait>
      a builder for type T
    • 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 the trait as a node.
    • builder

      public static IdRefTrait.Builder builder()