net.java.sezpoz
Class SpaceIndex<T extends Annotation,I>

java.lang.Object
  extended by net.java.sezpoz.SpaceIndex<T,I>
All Implemented Interfaces:
Iterable<SpaceIndexItem<T,I>>

public final class SpaceIndex<T extends Annotation,I>
extends Object
implements Iterable<SpaceIndexItem<T,I>>

Represents an index of a single annotation. Indices are not automatically cached (but reading them should be pretty cheap anyway).


Method Summary
 Iterator<SpaceIndexItem<T,I>> iterator()
          Find all items in the index.
static
<T extends Annotation,I>
SpaceIndex<T,I>
load(Class<T> annotation, Class<I> instanceType, org.sonatype.guice.bean.reflect.ClassSpace space, boolean globalIndex)
          Load an index for a given annotation type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

load

public static <T extends Annotation,I> SpaceIndex<T,I> load(Class<T> annotation,
                                                            Class<I> instanceType,
                                                            org.sonatype.guice.bean.reflect.ClassSpace space,
                                                            boolean globalIndex)
                                               throws IllegalArgumentException
Load an index for a given annotation type.

Parameters:
annotation - the type of annotation to find
instanceType - the type of instance to be created (use Void if all instances will be null)
space - a class space in which to find the index and any annotated classes
globalIndex - search the entire classloader hierarchy?
Returns:
an index of all elements known to be annotated with it
Throws:
IllegalArgumentException - if the annotation type is not marked with Indexable or the instance type is not equal to or a supertype of the annotation's actual Indexable.type()

iterator

public Iterator<SpaceIndexItem<T,I>> iterator()
Find all items in the index. Calls to iterator methods may fail with IndexError as the index is parsed lazily.

Specified by:
iterator in interface Iterable<SpaceIndexItem<T extends Annotation,I>>
Returns:
an iterator over items in the index


Copyright © 2004-2011 Hudson. All Rights Reserved.