Class OperationShape

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

public final class OperationShape extends Shape implements ToSmithyBuilder<OperationShape>
Represents an API operation.
  • Method Details

    • builder

      public static OperationShape.Builder builder()
    • toBuilder

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

      public <R> R accept(ShapeVisitor<R> visitor)
      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:
      visitor - ShapeVisitor to use.
      Returns:
      Returns the result.
    • asOperationShape

      public Optional<OperationShape> asOperationShape()
      Overrides:
      asOperationShape in class Shape
      Returns:
      Optionally returns the shape as an OperationShape.
    • 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;
    • getInput

      public Optional<ShapeId> getInput()

      Gets the optional shape ID of the input of the operation.

      For backward compatibility, if the input targets smithy.api#Unit, then an empty optional is returned.

      Returns:
      Returns the optional shape ID.
    • getOutput

      public Optional<ShapeId> getOutput()

      Gets the optional shape ID of the output of the operation.

      For backward compatibility, if the output targets smithy.api#Unit, then an empty optional is returned.

      Returns:
      Returns the optional shape ID.
    • getInputShape

      public ShapeId getInputShape()
      Gets the input of the operation.

      All operations have input, and they default to target smithy.api#Unit.

      Returns:
      Returns the non-nullable input.
    • getOutputShape

      public ShapeId getOutputShape()
      Gets the output of the operation.

      All operations have output, and they default to target smithy.api#Unit.

      Returns:
      Returns the non-nullable output.
    • getErrors

      public List<ShapeId> getErrors()

      Gets a list of the error shape IDs bound directly to the operation that can be encountered.

      This DOES NOT include errors that are common to a service. Operations can be bound to multiple services, so common service errors cannot be returned by this method. Use getErrors(ServiceShape) or OperationIndex.getErrors(ToShapeId, ToShapeId) to get all of the errors an operation can encounter when used within a service.

      Each returned ShapeId must resolve to a StructureShape that is targeted by an error trait; however, this is only guaranteed after a model is validated.

      Returns:
      Returns the errors.
      See Also:
    • getIntroducedErrors

      public List<ShapeId> getIntroducedErrors()
      Gets the errors introduced by the shape and not inherited from mixins.
      Returns:
      Returns the introduced errors.
    • getErrors

      public List<ShapeId> getErrors(ServiceShape service)

      Gets a list of the error shape IDs the operation can encounter, including any common errors of a service.

      No validation is performed here to ensure that the operation is actually bound to the given service shape.

      Returns:
      Returns the errors.
      See Also:
    • equals

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