|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.metadata.annotations.AbstractAnnotationReader
public abstract class AbstractAnnotationReader
Abstract implementation of a metadata annotations reader for JDK 1.5. A metadata annotation reader takes in a class and converts its annotations into internal metadata. Any implementation has to implement the method "processClassAnnotations" which creates the ClassMetaData record for the class, and the method "processFieldAnnotations" which updates the ClassMetaData with its field definition.
Each annotation reader supports a set of annotations. So it could support "JPA" annotations, or "JDO" annotations, or "DataNucleus" annotations or whatever.
| Field Summary | |
|---|---|
protected static Localiser |
LOCALISER
Localiser for messages |
protected MetaDataManager |
mgr
Manager for MetaData operations |
protected java.lang.String[] |
supportedPackages
Supported annotations packages. |
| Constructor Summary | |
|---|---|
AbstractAnnotationReader(MetaDataManager mgr)
Constructor. |
|
| Method Summary | |
|---|---|
protected AnnotationObject[] |
getAnnotationObjectsForAnnotations(java.lang.String clsName,
java.lang.annotation.Annotation[] annotations)
Convenience method to convert an array of Annotation objects into an array of AnnotationObjects. |
protected AnnotationObject[] |
getClassAnnotationsForClass(java.lang.Class cls)
Method returning the annotations for the class. |
protected java.util.Collection<org.datanucleus.metadata.annotations.AnnotatedMember> |
getFieldAnnotationsForClass(java.lang.Class cls)
Method returning a Map containing an array of the annotations for each field of the passed class, keyed by the field name. |
protected java.util.Collection<org.datanucleus.metadata.annotations.AnnotatedMember> |
getJavaBeanAccessorAnnotationsForClass(java.lang.Class cls)
Method returning a Map containing an array of the annotations for each Java Bean accessor method of the passed class, keyed by the method name. |
AbstractClassMetaData |
getMetaDataForClass(java.lang.Class cls,
PackageMetaData pmd,
ClassLoaderResolver clr)
Accessor for the ClassMetaData for the specified class from its annotations. |
protected java.util.Collection<java.lang.annotation.Annotation[]> |
getMethodAnnotationsForClass(java.lang.Class cls)
Method returning a Map containing an array of the annotations for each method of the passed class, keyed by the method name. |
java.lang.String[] |
getSupportedAnnotationPackages()
Method to set the valid annotation packages to be supported when reading. |
protected boolean |
isSupportedAnnotation(java.lang.String annotationClassName)
Convenience method to check whether an annotation class name is supported by this reader. |
protected abstract AbstractClassMetaData |
processClassAnnotations(PackageMetaData pmd,
java.lang.Class cls,
AnnotationObject[] annotations,
ClassLoaderResolver clr)
Method to process the "class" level annotations and create the outline ClassMetaData object. |
protected abstract AbstractMemberMetaData |
processMemberAnnotations(AbstractClassMetaData cmd,
Member member,
AnnotationObject[] annotations,
boolean propertyAccessor)
Method to take the passed in outline ClassMetaData and process the annotations for fields/properties adding any necessary FieldMetaData/PropertyMetaData to the ClassMetaData. |
protected abstract void |
processMethodAnnotations(AbstractClassMetaData cmd,
java.lang.reflect.Method method)
Method to take the passed in outline ClassMetaData and process the annotations for method adding any necessary MetaData to the ClassMetaData. |
protected void |
setSupportedAnnotationPackages(java.lang.String[] packages)
Method to set the valid annotation packages to be supported when reading. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Localiser LOCALISER
protected MetaDataManager mgr
protected java.lang.String[] supportedPackages
| Constructor Detail |
|---|
public AbstractAnnotationReader(MetaDataManager mgr)
mgr - MetaData manager| Method Detail |
|---|
public java.lang.String[] getSupportedAnnotationPackages()
getSupportedAnnotationPackages in interface AnnotationReaderprotected void setSupportedAnnotationPackages(java.lang.String[] packages)
packages - The supported packages.protected boolean isSupportedAnnotation(java.lang.String annotationClassName)
annotationClassName - Name of the annotation class
public AbstractClassMetaData getMetaDataForClass(java.lang.Class cls,
PackageMetaData pmd,
ClassLoaderResolver clr)
getMetaDataForClass in interface AnnotationReadercls - The classpmd - MetaData for the owning packageclr - ClassLoader resolver
protected abstract AbstractClassMetaData processClassAnnotations(PackageMetaData pmd,
java.lang.Class cls,
AnnotationObject[] annotations,
ClassLoaderResolver clr)
pmd - Parent PackageMetaDatacls - The classannotations - Annotations for the classclr - ClassLoader resolver
protected abstract AbstractMemberMetaData processMemberAnnotations(AbstractClassMetaData cmd,
Member member,
AnnotationObject[] annotations,
boolean propertyAccessor)
cmd - The ClassMetaData (to be updated)member - The field/property being processedannotations - The annotations for this field/propertypropertyAccessor - if has persistent properties
protected abstract void processMethodAnnotations(AbstractClassMetaData cmd,
java.lang.reflect.Method method)
cmd - The ClassMetaData (to be updated)method - The methodprotected AnnotationObject[] getClassAnnotationsForClass(java.lang.Class cls)
cls - The class
protected java.util.Collection<org.datanucleus.metadata.annotations.AnnotatedMember> getJavaBeanAccessorAnnotationsForClass(java.lang.Class cls)
cls - The class
protected java.util.Collection<java.lang.annotation.Annotation[]> getMethodAnnotationsForClass(java.lang.Class cls)
cls - The class
protected java.util.Collection<org.datanucleus.metadata.annotations.AnnotatedMember> getFieldAnnotationsForClass(java.lang.Class cls)
cls - The class
protected AnnotationObject[] getAnnotationObjectsForAnnotations(java.lang.String clsName,
java.lang.annotation.Annotation[] annotations)
clsName - Name of the classannotations - The annotations
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||