org.datanucleus.jpa.metadata
Class JPAAnnotationReader

java.lang.Object
  extended by org.datanucleus.metadata.annotations.AbstractAnnotationReader
      extended by org.datanucleus.jpa.metadata.JPAAnnotationReader
All Implemented Interfaces:
org.datanucleus.metadata.annotations.AnnotationReader

public class JPAAnnotationReader
extends org.datanucleus.metadata.annotations.AbstractAnnotationReader

Implementation for Annotation Reader for JDK 1.5 annotations using JPA's definition. This reader also accepts certain DataNucleus extensions where the JPA annotations don't provide full definition of the data required.


Field Summary
 
Fields inherited from class org.datanucleus.metadata.annotations.AbstractAnnotationReader
LOCALISER, mgr, supportedPackages
 
Constructor Summary
JPAAnnotationReader(org.datanucleus.metadata.MetaDataManager mgr)
          Constructor.
 
Method Summary
protected  boolean isClassPersistenceAware(java.lang.Class cls)
          Check if class is persistence aware, by looking at annotations
protected  boolean isClassPersistenceCapable(java.lang.Class cls)
          Check if class is persistence capable, by looking at annotations
protected  org.datanucleus.metadata.AbstractClassMetaData processClassAnnotations(org.datanucleus.metadata.PackageMetaData pmd, java.lang.Class cls, org.datanucleus.metadata.annotations.AnnotationObject[] annotations, org.datanucleus.ClassLoaderResolver clr)
          Method to process the "class" level annotations and create the outline ClassMetaData object
protected  void processEmbeddedAttributeOverride(org.datanucleus.metadata.AbstractMemberMetaData mmd, java.lang.String overriddenName, java.lang.Class type, javax.persistence.Column column)
          Method to process the override of embedded members.
protected  org.datanucleus.metadata.AbstractMemberMetaData processMemberAnnotations(org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.metadata.annotations.Member member, org.datanucleus.metadata.annotations.AnnotationObject[] annotations, boolean propertyAccessor)
          Convenience method to process the annotations for a field/property.
protected  void processMethodAnnotations(org.datanucleus.metadata.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.
 
Methods inherited from class org.datanucleus.metadata.annotations.AbstractAnnotationReader
getAnnotationObjectsForAnnotations, getClassAnnotationsForClass, getFieldAnnotationsForClass, getJavaBeanAccessorAnnotationsForClass, getMetaDataForClass, getMethodAnnotationsForClass, getSupportedAnnotationPackages, isSupportedAnnotation, setSupportedAnnotationPackages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPAAnnotationReader

public JPAAnnotationReader(org.datanucleus.metadata.MetaDataManager mgr)
Constructor.

Parameters:
mgr - MetaData manager
Method Detail

processClassAnnotations

protected org.datanucleus.metadata.AbstractClassMetaData processClassAnnotations(org.datanucleus.metadata.PackageMetaData pmd,
                                                                                 java.lang.Class cls,
                                                                                 org.datanucleus.metadata.annotations.AnnotationObject[] annotations,
                                                                                 org.datanucleus.ClassLoaderResolver clr)
Method to process the "class" level annotations and create the outline ClassMetaData object

Specified by:
processClassAnnotations in class org.datanucleus.metadata.annotations.AbstractAnnotationReader
Parameters:
pmd - Parent PackageMetaData
cls - The class
annotations - Annotations for this class
clr - ClassLoader resolver
Returns:
The ClassMetaData (or null if no annotations)

processMemberAnnotations

protected org.datanucleus.metadata.AbstractMemberMetaData processMemberAnnotations(org.datanucleus.metadata.AbstractClassMetaData cmd,
                                                                                   org.datanucleus.metadata.annotations.Member member,
                                                                                   org.datanucleus.metadata.annotations.AnnotationObject[] annotations,
                                                                                   boolean propertyAccessor)
Convenience method to process the annotations for a field/property. The passed annotations may have been specified on the field or on a getter method.

Specified by:
processMemberAnnotations in class org.datanucleus.metadata.annotations.AbstractAnnotationReader
Parameters:
cmd - The ClassMetaData to update
member - The field/property
annotations - The annotations for the field/property
propertyAccessor - if has persistent properties
Returns:
The FieldMetaData/PropertyMetaData that was added (if any)

processEmbeddedAttributeOverride

protected void processEmbeddedAttributeOverride(org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                java.lang.String overriddenName,
                                                java.lang.Class type,
                                                javax.persistence.Column column)
Method to process the override of embedded members. Can recurse if the overriddenName uses "dot" syntax.

Parameters:
mmd - Metadata for this member
overriddenName - The overridden member within this embedded object
type - Type of this member
column - The column details to override it with

processMethodAnnotations

protected void processMethodAnnotations(org.datanucleus.metadata.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.

Specified by:
processMethodAnnotations in class org.datanucleus.metadata.annotations.AbstractAnnotationReader
Parameters:
cmd - The ClassMetaData (to be updated)
method - The method

isClassPersistenceCapable

protected boolean isClassPersistenceCapable(java.lang.Class cls)
Check if class is persistence capable, by looking at annotations

Parameters:
cls - the Class
Returns:
true if the class has Entity annotation

isClassPersistenceAware

protected boolean isClassPersistenceAware(java.lang.Class cls)
Check if class is persistence aware, by looking at annotations

Parameters:
cls - the Class
Returns:
true if the class has @PersistenceAware


Copyright © 2011. All Rights Reserved.