Class PropertyBindingIndex

java.lang.Object
software.amazon.smithy.model.knowledge.PropertyBindingIndex
All Implemented Interfaces:
KnowledgeIndex

public final class PropertyBindingIndex extends Object implements KnowledgeIndex
Index of member shape to associated resource property information.
  • Method Details

    • of

      public static PropertyBindingIndex of(Model model)
    • getOperationOutputElementShape

      public Optional<ShapeId> getOperationOutputElementShape(ToShapeId resource, ToShapeId operation)
      Gets the element structure of a collection-bound operation's output that carries per-instance resource state.

      The element structure is the structure targeted by the members of the list targeted by the output member marked with the @nestedProperties trait, or, for the list lifecycle without that trait, by a single unambiguous list-of-structures output member.

      Parameters:
      resource - Shape ID of a resource.
      operation - Shape ID of an operation.
      Returns:
      the element structure ID of the operation's output, if any.
    • getOperationInputElementShape

      public Optional<ShapeId> getOperationInputElementShape(ToShapeId resource, ToShapeId operation)
      Gets the element structure of a collection-bound operation's input that carries per-instance resource state, resolved through the input member marked with the @nestedProperties trait.
      Parameters:
      resource - Shape ID of a resource.
      operation - Shape ID of an operation.
      Returns:
      the element structure ID of the operation's input, if any.
    • isOperationOutputElementExplicit

      public boolean isOperationOutputElementExplicit(ToShapeId resource, ToShapeId operation)
      Returns true if the output element structure of the operation was explicitly marked with the @nestedProperties trait rather than automatically detected.
      Parameters:
      resource - Shape ID of a resource.
      operation - Shape ID of an operation.
      Returns:
      true if the output element binding is explicit.
    • getOperationOutputElementProperties

      public Map<String,String> getOperationOutputElementProperties(ToShapeId resource, ToShapeId operation)
      Gets a map of element member names to resource property names for the element structure of a collection-bound operation's output.
      Parameters:
      resource - Shape ID of a resource.
      operation - Shape ID of an operation.
      Returns:
      the member name to property name map, or an empty map.
    • getOperationInputElementProperties

      public Map<String,String> getOperationInputElementProperties(ToShapeId resource, ToShapeId operation)
      Gets a map of element member names to resource property names for the element structure of a collection-bound operation's input.
      Parameters:
      resource - Shape ID of a resource.
      operation - Shape ID of an operation.
      Returns:
      the member name to property name map, or an empty map.
    • getPropertyName

      public Optional<String> getPropertyName(ShapeId memberShapeId)
      Gets the property name for a given member shape. Returns empty optional if the member shape does not correspond to a property.
      Parameters:
      memberShapeId - the ShapeId of the member shape to get the property name for.
      Returns:
      the property name for a given member shape if there is one.
    • isMemberShapeProperty

      public boolean isMemberShapeProperty(MemberShape memberShape)
      Returns true if a member shape positively maps to a property. will return a non-empty Optional if this method returns true.
      Parameters:
      memberShape - the member shape to check
      Returns:
      true if member shape maps to a property on the given resource
    • getOutputPropertiesShape

      public StructureShape getOutputPropertiesShape(OperationShape operation)
      Resolves and returns the output shape of an operation that contains the top-level resource bound properties. Handles adjustments made with @nestedProperties trait.
      Parameters:
      operation - operation to retrieve output properties shape for.
      Returns:
      the output shape of an operation that contains top-level resource properties.
    • getInputPropertiesShape

      public StructureShape getInputPropertiesShape(OperationShape operation)
      Resolves and returns the input shape of an operation that contains the top-level resource bound properties. Handles adjustments made with @nestedProperties trait.
      Parameters:
      operation - operation to retrieve output properties shape for
      Returns:
      the input shape of an operation that contains top-level resource properties.
    • doesMemberShapeRequireProperty

      public boolean doesMemberShapeRequireProperty(MemberShape memberShape)
      Returns true if member is required to have an associated property mapping.
      Parameters:
      memberShape - the member shape to check
      Returns:
      True if input/output member is required to have a property mapping.
    • isNotPropertyMember

      public boolean isNotPropertyMember(MemberShape memberShape)
      Returns true if the member is excluded from resource property binding by the @notProperty trait or by a trait marked with it.
      Parameters:
      memberShape - the member shape to check
      Returns:
      true if the member is explicitly excluded from property binding.