Class BottomUpIndex
- java.lang.Object
-
- software.amazon.smithy.model.knowledge.BottomUpIndex
-
- All Implemented Interfaces:
KnowledgeIndex
public final class BottomUpIndex extends java.lang.Object implements KnowledgeIndex
Computes all of the parent shapes of resources and operations from the bottom-up.
-
-
Constructor Summary
Constructors Constructor Description BottomUpIndex(Model model)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<EntityShape>
getAllParents(ToShapeId service, ToShapeId operationOrResource)
Gets all of the parents of an operation or resource within a service.java.util.Optional<EntityShape>
getEntityBinding(ToShapeId service, ToShapeId operationOrResource)
Gets the direct parent of an operation or resource.java.util.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.static BottomUpIndex
of(Model model)
-
-
-
Constructor Detail
-
BottomUpIndex
public BottomUpIndex(Model model)
-
-
Method Detail
-
of
public static BottomUpIndex of(Model model)
-
getAllParents
public java.util.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 aServiceShape
.- 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 java.util.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 java.util.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.
-
-