Class Index<A extends Annotation>

  • All Implemented Interfaces:
    Iterable<IndexItem<A>>

    public class Index<A extends Annotation>
    extends Object
    implements Iterable<IndexItem<A>>
    Makes the annotation indexes accessible.

    You would call it like this:

     for (IndexItem<MyAnnotation> item : Index.load(MyAnnotation.class)) {
       // do something with item.annotation() and/or item.className()
     }
     
    Author:
    Johannes Schindelin
    • Method Detail

      • load

        public static <A extends AnnotationIndex<A> load​(Class<A> annotation)
        Loads the index of all classes annotated with the specified annotation.

        The specified annotation needs to be annotated with Indexable for the annotation indexing to work properly, of course.

        Parameters:
        annotation - the annotation type
        Returns:
        the index
      • load

        public static <A extends AnnotationIndex<A> load​(Class<A> annotation,
                                                           ClassLoader loader)
        Loads the index of all classes annotated with the specified annotation.
        Parameters:
        annotation - the annotation type
        loader - the class loader to use when loading Class-type annotation fields
        Returns:
        the index