Package net.java.sezpoz
Class IndexItem<A extends java.lang.annotation.Annotation,I>
- java.lang.Object
-
- net.java.sezpoz.IndexItem<A,I>
-
public final class IndexItem<A extends java.lang.annotation.Annotation,I> extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description A
annotation()
Get the annotation itself.java.lang.String
className()
Get the name of the class which is the annotated element or of which the annotated element is a member.java.lang.reflect.AnnotatedElement
element()
Get the live annotated element.boolean
equals(java.lang.Object obj)
int
hashCode()
I
instance()
Get an instance referred to by the element.java.lang.annotation.ElementType
kind()
Determine what kind of element is annotated.java.lang.String
memberName()
Get the name of the annotated member element.java.lang.String
toString()
-
-
-
Method Detail
-
annotation
public A annotation()
Get the annotation itself. A lightweight proxy will be returned which obeys theAnnotation
contract and should be equal to (but not identical to) the "real" annotation available fromAnnotatedElement.getAnnotation(java.lang.Class<T>)
onelement
(if in fact it has runtime retention, which is encouraged but not required).- Returns:
- a live or proxy annotation
-
kind
public java.lang.annotation.ElementType kind()
Determine what kind of element is annotated.- Returns:
- one of
ElementType.TYPE
,ElementType.METHOD
, orElementType.FIELD
-
className
public java.lang.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 java.lang.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 java.lang.reflect.AnnotatedElement element() throws java.lang.InstantiationException
Get the live annotated element.- Returns:
- a
Class
,Method
, orField
- Throws:
java.lang.InstantiationException
- if the class cannot be loaded or there is some other reflective problem
-
instance
public I instance() throws java.lang.InstantiationException
Get an instance referred to by the element. This instance is cached by the item object. The element must always be public.- In case of a class, the class will be instantiated by a public no-argument constructor.
- In case of a method, it must be static and have no arguments; it will be called.
- 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:
java.lang.InstantiationException
- for the same reasons aselement
, or if creating the object fails
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-