Interface KnowledgeIndex
-
- All Known Implementing Classes:
ArnIndex
,AuthorizerIndex
,BottomUpIndex
,BoxIndex
,ClientEndpointDiscoveryIndex
,ConditionKeysIndex
,EventStreamIndex
,HttpBindingIndex
,IdentifierBindingIndex
,IntegrationTraitIndex
,NeighborProviderIndex
,OperationIndex
,PaginatedIndex
,PlaneIndex
,ResolvedTopicIndex
,ServiceIndex
,TopDownIndex
public interface KnowledgeIndex
Contains an index of computed knowledge about aModel
.A KnowledgeIndex is created to reduce code duplication and complexity of extracting and computing information about a model. A KnowledgeIndex is often a mapping of
ShapeId
to some kind of interesting computed information. For example, in order to resolve the input/output/error structures referenced by anOperationShape
, you need aModel
, to ensure that the reference from the operation to the structure is resolvable in the model, that the shape it references is a structure, and then to cast the shape to aStructureShape
. Because this process is error prone, verbose, and is required by a large number of validators and tools, Smithy provides aOperationIndex
to compute it automatically.The
Model.getKnowledge(java.lang.Class<T>)
method should be used to create instances of a KnowledgeIndex. Creating instances of a KnowledgeIndex using this method reduces the number of times the results of a KnowledgeIndex needs to be computed for a specific Model. In order to use this method, implementations of a KnowledgeIndex must provide a public constructor that accepts aModel
.
-
-
Method Summary
Static Methods Modifier and Type Method Description static <T extends KnowledgeIndex>
Tcreate(java.lang.Class<T> type, Model model)
Creates a KnowledgeIndex for a particular class.
-
-
-
Method Detail
-
create
static <T extends KnowledgeIndex> T create(java.lang.Class<T> type, Model model)
Creates a KnowledgeIndex for a particular class.- Type Parameters:
T
- Type of knowledge index to create.- Parameters:
model
- Model to provide to the knowledge index constructor.type
- Class to create.- Returns:
- Returns the created KnowledgeIndex.
- Throws:
java.lang.RuntimeException
- if the index cannot be created.
-
-