Package net.java.sezpoz
Class IndexItem<A extends Annotation,I>
java.lang.Object
net.java.sezpoz.IndexItem<A,I>
- Record Components:
A
- the type of annotation being loadedI
- the type of instance being loaded
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
Modifier and TypeMethodDescriptionGet the annotation itself.Get the name of the class which is the annotated element or of which the annotated element is a member.element()
Get the live annotated element.boolean
int
hashCode()
instance()
Get an instance referred to by the element.kind()
Determine what kind of element is annotated.Get the name of the annotated member element.toString()
-
Method Details
-
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
Determine what kind of element is annotated.- Returns:
- one of
ElementType.TYPE
,ElementType.METHOD
, orElementType.FIELD
-
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
Get the name of the annotated member element.- Returns:
- a method or field name, or null if the annotated element is a class
-
element
Get the live annotated element.- Returns:
- a
Class
,Method
, orField
- Throws:
InstantiationException
- if the class cannot be loaded or there is some other reflective problem
-
instance
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:
InstantiationException
- for the same reasons aselement
, or if creating the object fails
-
hashCode
public int hashCode() -
equals
-
toString
-