Class UnionShape

java.lang.Object
software.amazon.smithy.model.shapes.Shape
software.amazon.smithy.model.shapes.UnionShape
All Implemented Interfaces:
Comparable<Shape>, FromSourceLocation, ToShapeId, Tagged, ToSmithyBuilder<UnionShape>

public final class UnionShape extends Shape implements ToSmithyBuilder<UnionShape>
Tagged union shape that maps member names to member definitions.
  • Method Details

    • builder

      public static UnionShape.Builder builder()
    • toBuilder

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

      public <R> R accept(ShapeVisitor<R> cases)
      Description copied from class: Shape
      Dispatches the shape to the appropriate ShapeVisitor method.
      Specified by:
      accept in class Shape
      Type Parameters:
      R - Return type of the accept.
      Parameters:
      cases - NeighborVisitor to use.
      Returns:
      Returns the result.
    • asUnionShape

      public Optional<UnionShape> asUnionShape()
      Overrides:
      asUnionShape in class Shape
      Returns:
      Optionally returns the shape as a UnionShape.
    • getType

      public ShapeType getType()
      Description copied from class: Shape
      Gets the type of the shape.
      Specified by:
      getType in class Shape
      Returns:
      Returns the type;
    • getAllMembers

      public Map<String,MemberShape> getAllMembers()
      Gets the members of the shape.
      Returns:
      Returns the immutable member map.
    • getMemberNames

      public List<String> getMemberNames()
      Returns an ordered list of member names based on the order they are defined in the model.
      Returns:
      Returns an immutable list of member names.
    • getMember

      public Optional<MemberShape> getMember(String name)
      Get a specific member by name.
      Parameters:
      name - Name of the member to retrieve.
      Returns:
      Returns the optional member.
    • members

      public Collection<MemberShape> members()
      Description copied from class: Shape
      Gets all of the members contained in the shape.
      Overrides:
      members in class Shape
      Returns:
      Returns the members contained in the shape (if any).
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Shape