Class OperationIndex

  • All Implemented Interfaces:
    KnowledgeIndex

    public final class OperationIndex
    extends java.lang.Object
    implements KnowledgeIndex
    Index of operation IDs to their resolved input, output, and error structures.

    This index performs no validation that the input, output, and errors actually reference valid structures.

    • Constructor Detail

      • OperationIndex

        public OperationIndex​(Model model)
    • Method Detail

      • getInput

        public java.util.Optional<StructureShape> getInput​(ToShapeId operation)
        Gets the optional input structure of an operation.
        Parameters:
        operation - Operation to get the input structure of.
        Returns:
        Returns the optional operation input structure.
      • getInputMembers

        public java.util.Map<java.lang.String,​MemberShape> getInputMembers​(ToShapeId operation)
        Gets the input members of an operation as a map of member names to MemberShape.

        The return map is ordered using the same order defined in the model. If the operation has no input, an empty map is returned.

        Parameters:
        operation - Operation to get the input members of.
        Returns:
        Returns the map of members, or an empty map.
      • isInputStructure

        public boolean isInputStructure​(ToShapeId structureId)
        Returns true if the given structure is used as input by any operation in the model.
        Parameters:
        structureId - Structure to check.
        Returns:
        Returns true if the structure is used as input.
      • getOutput

        public java.util.Optional<StructureShape> getOutput​(ToShapeId operation)
        Gets the optional output structure of an operation.
        Parameters:
        operation - Operation to get the output structure of.
        Returns:
        Returns the optional operation output structure.
      • getOutputMembers

        public java.util.Map<java.lang.String,​MemberShape> getOutputMembers​(ToShapeId operation)
        Gets the output members of an operation as a map of member names to MemberShape.

        The return map is ordered using the same order defined in the model. If the operation has no output, an empty map is returned.

        Parameters:
        operation - Operation to get the output members of.
        Returns:
        Returns the map of members, or an empty map.
      • isOutputStructure

        public boolean isOutputStructure​(ToShapeId structureId)
        Returns true if the given structure is used as output by any operation in the model.
        Parameters:
        structureId - Structure to check.
        Returns:
        Returns true if the structure is used as output.
      • getErrors

        public java.util.List<StructureShape> getErrors​(ToShapeId operation)
        Gets the list of error structures defined on an operation.

        An empty list is returned if the operation is not found or has no errors.

        Parameters:
        operation - Operation to get the errors of.
        Returns:
        Returns the list of error structures, or an empty list.