|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjodd.util.AnnotationDataReader<A,D>
public abstract class AnnotationDataReader<A extends java.lang.annotation.Annotation,D extends AnnotationDataReader.AnnotationData<A>>
Annotation reader that reads an annotation and returns annotation data object filled with annotation element values. May be used when having two or more annotations with same elements - since java doesn't support annotation inheritance.
| Nested Class Summary | |
|---|---|
static class |
AnnotationDataReader.AnnotationData<N extends java.lang.annotation.Annotation>
Base class for annotation data, for holding annotation elements values. |
| Field Summary | |
|---|---|
protected java.lang.Class<A> |
annotationClass
|
| Constructor Summary | |
|---|---|
protected |
AnnotationDataReader()
Creates new annotation data reader using annotation definition from class generics. |
protected |
AnnotationDataReader(java.lang.Class<A> annotationClass)
Creates new annotation data reader using provided annotation class. |
| Method Summary | |
|---|---|
protected abstract D |
createAnnotationData(A annotation)
Creates annotation data from given annotation. |
java.lang.Class<A> |
getAnnotationClass()
Returns annotation class. |
boolean |
hasAnnotation(java.lang.reflect.AccessibleObject accessibleObject)
Returns true if annotation is present on
given accessible object. |
D |
readAnnotationData(java.lang.reflect.AccessibleObject accessibleObject)
Reads annotation data on provided accessible object. |
protected java.lang.Object |
readElement(A annotation,
java.lang.String name)
Reads annotation element as an object. |
protected java.lang.String |
readStringElement(A annotation,
java.lang.String name)
Reads non-empty, trimmed, annotation element value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.lang.Class<A extends java.lang.annotation.Annotation> annotationClass
| Constructor Detail |
|---|
protected AnnotationDataReader()
protected AnnotationDataReader(java.lang.Class<A> annotationClass)
| Method Detail |
|---|
public java.lang.Class<A> getAnnotationClass()
public boolean hasAnnotation(java.lang.reflect.AccessibleObject accessibleObject)
true if annotation is present on
given accessible object.
public D readAnnotationData(java.lang.reflect.AccessibleObject accessibleObject)
annotation data on provided accessible object.
If annotation is not presented, null is returned.
protected abstract D createAnnotationData(A annotation)
protected java.lang.String readStringElement(A annotation,
java.lang.String name)
null.
protected java.lang.Object readElement(A annotation,
java.lang.String name)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||