Package org.scijava.annotations
Class Index<A extends Annotation>
- java.lang.Object
-
- org.scijava.annotations.Index<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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<IndexItem<A>>iterator()static <A extends Annotation>
Index<A>load(Class<A> annotation)Loads the index of all classes annotated with the specified annotation.static <A extends Annotation>
Index<A>load(Class<A> annotation, ClassLoader loader)Loads the index of all classes annotated with the specified annotation.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
load
public static <A extends Annotation> Index<A> load(Class<A> annotation)
Loads the index of all classes annotated with the specified annotation.The specified annotation needs to be annotated with
Indexablefor the annotation indexing to work properly, of course.- Parameters:
annotation- the annotation type- Returns:
- the index
-
load
public static <A extends Annotation> Index<A> load(Class<A> annotation, ClassLoader loader)
Loads the index of all classes annotated with the specified annotation.- Parameters:
annotation- the annotation typeloader- the class loader to use when loadingClass-type annotation fields- Returns:
- the index
-
-