net.java.sezpoz
Class SpaceIndexItem<A extends Annotation,I>

java.lang.Object
  extended by net.java.sezpoz.SpaceIndexItem<A,I>

public final class SpaceIndexItem<A extends Annotation,I>
extends Object

One index item. May be associated with a class, method, or field. Caches result of element and instance after first call. Not thread-safe.


Method Summary
 A annotation()
          Get the annotation itself.
 String className()
          Get the name of the class which is the annotated element or of which the annotated element is a member.
 AnnotatedElement element()
          Get the live annotated element.
 boolean equals(Object obj)
           
 int hashCode()
           
 I instance()
          Get an instance referred to by the element.
 ElementType kind()
          Determine what kind of element is annotated.
 String memberName()
          Get the name of the annotated member element.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

annotation

public A annotation()
Get the annotation itself. A lightweight proxy will be returned which obeys the Annotation contract and should be equal to (but not identical to) the "real" annotation available from AnnotatedElement.getAnnotation(java.lang.Class) on element (if in fact it has runtime retention, which is encouraged but not required).

Returns:
a live or proxy annotation

kind

public ElementType kind()
Determine what kind of element is annotated.

Returns:
one of ElementType.TYPE, ElementType.METHOD, or ElementType.FIELD

className

public String className()
Get the name of the class which is the annotated element or of which the annotated element is a member.

Returns:
the class name (format e.g. "x.y.Z$I")

memberName

public String memberName()
Get the name of the annotated member element.

Returns:
a method or field name, or null if the annotated element is a class

element

public AnnotatedElement element()
                         throws InstantiationException
Get the live annotated element.

Returns:
a Class, Method, or Field
Throws:
InstantiationException - if the class cannot be loaded or there is some other reflective problem

instance

public I instance()
           throws InstantiationException
Get an instance referred to by the element. This instance is cached by the item object. The element must always be public.
  1. In case of a class, the class will be instantiated by a public no-argument constructor.
  2. In case of a method, it must be static and have no arguments; it will be called.
  3. In case of a field, it must be static and final; its value will be used.

Returns:
an object guaranteed to be assignable to the Indexable.type() if specified (or may be null, in the case of a method or field)
Throws:
InstantiationException - for the same reasons as element, or if creating the object fails

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2011 Hudson. All Rights Reserved.