Interface KnowledgeIndex

  • All Known Implementing Classes:
    AuthIndex, BottomUpIndex, BoxIndex, EventStreamIndex, HttpBindingIndex, IdentifierBindingIndex, NeighborProviderIndex, OperationIndex, PaginatedIndex, TopDownIndex

    public interface KnowledgeIndex
    Contains an index of computed knowledge about a Model.

    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 an OperationShape, you need a Model, to ensure that the reference from the operation to the structure is resolvable in the shape index, that the shape it references is a structure, and then to cast the shape to a StructureShape. Because this process is error prone, verbose, and is required by a large number of validators and tools, Smithy provides a OperationIndex 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 a Model.

    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static <T extends KnowledgeIndex>
      T
      create​(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.