Class OperationIndex
- java.lang.Object
-
- software.amazon.smithy.model.knowledge.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 Summary
Constructors Constructor Description OperationIndex(Model model)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<StructureShape>
getErrors(ToShapeId operation)
Gets the list of error structures defined on an operation.java.util.Optional<StructureShape>
getInput(ToShapeId operation)
Gets the optional input structure of an operation.java.util.Map<java.lang.String,MemberShape>
getInputMembers(ToShapeId operation)
Gets the input members of an operation as a map of member names toMemberShape
.java.util.Optional<StructureShape>
getOutput(ToShapeId operation)
Gets the optional output structure of an operation.java.util.Map<java.lang.String,MemberShape>
getOutputMembers(ToShapeId operation)
Gets the output members of an operation as a map of member names toMemberShape
.boolean
isInputStructure(ToShapeId structureId)
Returns true if the given structure is used as input by any operation in the model.boolean
isOutputStructure(ToShapeId structureId)
Returns true if the given structure is used as output by any operation in the model.static OperationIndex
of(Model model)
-
-
-
Constructor Detail
-
OperationIndex
public OperationIndex(Model model)
-
-
Method Detail
-
of
public static OperationIndex of(Model model)
-
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 toMemberShape
.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 toMemberShape
.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.
-
-