Class ShapeClosure

java.lang.Object
software.amazon.smithy.model.metadata.ShapeClosure
All Implemented Interfaces:
FromSourceLocation, ToNode, ToSmithyBuilder<ShapeClosure>

public final class ShapeClosure extends Object implements ToNode, ToSmithyBuilder<ShapeClosure>, FromSourceLocation
A named closure of shapes.

This is defined in the model as an entry in the shapeClosures list.

  • Field Details

    • METADATA_KEY

      public static final String METADATA_KEY
      The metadata key under which a list of shape closures is stored.
      See Also:
  • Method Details

    • builder

      public static ShapeClosure.Builder builder()
      Creates a builder for a ShapeClosure.
      Returns:
      the created builder.
    • fromNode

      public static ShapeClosure fromNode(Node node)
      Creates a ShapeClosure from a single closure node.
      Parameters:
      node - Object node to parse.
      Returns:
      the parsed closure.
    • fromModel

      public static Map<String,ShapeClosure> fromModel(Model model)
      Extracts every shapeClosures entry from a model's metadata.
      Parameters:
      model - Model to read the shapeClosures metadata from.
      Returns:
      an ordered map of closure id to closure, empty if none are defined.
    • fromModel

      public static Map<String,ShapeClosure> fromModel(Map<String,Node> metadata)
      Extracts every well-formed shapeClosures entry from model metadata.

      Entries that cannot be parsed (for example, a missing id or a malformed rename key) are skipped; those problems are reported separately by model validation.

      Parameters:
      metadata - Model metadata to read the shapeClosures entry from.
      Returns:
      an ordered map of closure id to closure, empty if none are defined.
    • getId

      public String getId()
      Gets the identifier used to refer to this closure.
      Returns:
      the closure id.
    • getIncludeNamespaces

      public Set<String> getIncludeNamespaces()
      Gets the namespaces whose shapes are included in the closure.
      Returns:
      the included namespaces, or an empty set if none are defined.
    • getIncludeBySelector

      public Optional<String> getIncludeBySelector()
      Gets the selector whose matched shapes are included in the closure.
      Returns:
      the selector expression, or empty if none is defined.
    • getRename

      public Map<ShapeId,String> getRename()
      Gets the shape renames applied within the closure.

      Each key is the id of a shape in the closure, and each value is the name, without a namespace, to use for that shape within the closure.

      Returns:
      a map of shape id to replacement name, empty if none are defined.
    • getDocumentation

      public Optional<String> getDocumentation()
      Gets the documentation for the closure.
      Returns:
      the documentation for the closure.
    • getSourceLocation

      public SourceLocation getSourceLocation()
      Description copied from interface: FromSourceLocation
      Gets the source location of a value.
      Specified by:
      getSourceLocation in interface FromSourceLocation
      Returns:
      Returns the source location of the value.
    • toNode

      public Node toNode()
      Description copied from interface: ToNode
      Converts a value to a Node.
      Specified by:
      toNode in interface ToNode
      Returns:
      Returns the creates Node.
    • toBuilder

      public ShapeClosure.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<ShapeClosure>
      Returns:
      a builder for type T
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object