org.scijava.annotations
Class Index<A extends Annotation>

java.lang.Object
  extended by org.scijava.annotations.Index<A>
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 item : Index.load(MyAnnotation.class)) {
// do something with item.annotation() and/or item.className()
}

Author:
Johannes Schindelin

Method Summary
 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
 

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 Indexable for the annotation indexing to work properly, of course.

Parameters:
annotation - the annotation type
Returns:
the index
Throws:
IOException

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 type
loader - the class loader to use when loading Class-type annotation fields
Returns:
the index
Throws:
IOException

iterator

public Iterator<IndexItem<A>> iterator()
Specified by:
iterator in interface Iterable<IndexItem<A extends Annotation>>


Copyright © 2009–2014 SciJava. All rights reserved.