Class BottomUpIndex

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

public final class BottomUpIndex extends Object implements KnowledgeIndex
Computes all of the parent shapes of resources and operations from the bottom-up.
  • Constructor Details

    • BottomUpIndex

      public BottomUpIndex(Model model)
  • Method Details

    • of

      public static BottomUpIndex of(Model model)
    • getAllParents

      public List<EntityShape> getAllParents(ToShapeId service, ToShapeId operationOrResource)
      Gets all of the parents of an operation or resource within a service.

      The returned list contains each EntityShape parent (a resource or service shape). The first element in the list is the direct parent of the resource/operation, followed by that resource's parent, until finally the last element in the list is always a ServiceShape.

      Parameters:
      service - Service to query.
      operationOrResource - The operation or resource for which to find the parents.
      Returns:
      Returns the parents of the resource.
    • getEntityBinding

      public Optional<EntityShape> getEntityBinding(ToShapeId service, ToShapeId operationOrResource)
      Gets the direct parent of an operation or resource.
      Parameters:
      service - Service closure to query.
      operationOrResource - The operation or resource to query.
      Returns:
      Returns the optionally found parent, a resource or service shape.
    • getResourceBinding

      public Optional<ResourceShape> getResourceBinding(ToShapeId service, ToShapeId operationOrResource)
      Gets the direct parent resource of an operation or resource if and only if the given resource or operation is bound to a resource and not bound to a service.
      Parameters:
      service - Service closure to query.
      operationOrResource - The operation or resource to query.
      Returns:
      Returns the optionally found parent resource.