Class LazyIndexer

java.lang.Object
io.quarkus.deployment.index.LazyIndexer

public class LazyIndexer extends Object
A lazy creator of a Jandex Index. It reads class data from a given class loader and skips classes that are present in the given existing Jandex index.

Expected usage:

  1. Create an instance: new LazyIndexer(classLoader, existingIndex)
  2. Add class names to be indexed lazily: add(className), addAll(classNames)
  3. Run the indexing process: var result = indexer.complete()
After calling complete(), the instance should be thrown away. The resulting index is expected to be combined with the given existing index using a CompositeIndex or StackedIndex.
  • Constructor Details

    • LazyIndexer

      public LazyIndexer(ClassLoader classLoader, org.jboss.jandex.IndexView existingIndex)
  • Method Details

    • add

      public void add(String className)
      Adds the given className to the set of classes to be indexed lazily.

      The given class, all its superclasses, and all annotations found on the class and its superclasses will be indexed.

    • addAll

      public void addAll(Collection<String> classNames)
      Adds all given classNames to the set of classes to be indexed lazily.

      The given classes, all their superclasses, and all annotations found on the classes and their superclasses will be indexed.

    • add

      public void add(String className, byte[] classData)
      Adds the given className to the set of classes to be indexed lazily. The class data will not be obtained from the class loader; instead, the given classData will be used.

      The given class and all annotations found on it will be indexed. Unlike the other add methods, superclasses will not be indexed.

      If the same class name has already been added with different class data, an exception is thrown.

    • complete

      public LazyIndexer.Result complete()
      Runs the indexing process. All classes added via add() are indexed and the LazyIndexer.Result is returned. If a class is not found in the class loader, an exception is thrown, unless it is a class of an annotation that is present on one of the previously indexed classes.