Package org.datanucleus.api.jpa.metadata
Class JPAAnnotationReader
- java.lang.Object
-
- org.datanucleus.metadata.annotations.AbstractAnnotationReader
-
- org.datanucleus.api.jpa.metadata.JPAAnnotationReader
-
- All Implemented Interfaces:
org.datanucleus.metadata.annotations.AnnotationReader
public class JPAAnnotationReader extends org.datanucleus.metadata.annotations.AbstractAnnotationReaderImplementation for Annotation Reader for Java 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.
-
-
Constructor Summary
Constructors Constructor Description JPAAnnotationReader(org.datanucleus.metadata.MetaDataManager mgr)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleandoesClassHaveConverter(Class cls, org.datanucleus.metadata.annotations.AnnotationObject[] annotations)Check if class has Converter annotation by inspecting its annotations.protected booleandoesClassHaveNamedQueries(org.datanucleus.metadata.annotations.AnnotationObject[] annotations)Check if class has NamedXXXQuery annotations (for classes that are not persistable but provide named query definitions.protected org.datanucleus.metadata.StoredProcQueryParameterMetaDatagetMetaDataForStoredProcParameter(javax.persistence.StoredProcedureParameter param)protected org.datanucleus.metadata.annotations.AnnotationObjectisClassPersistable(org.datanucleus.metadata.annotations.AnnotationObject[] annotations)Check if a class is persistable, by looking at its annotations.protected booleanisClassPersistenceAware(org.datanucleus.metadata.annotations.AnnotationObject[] annotations)Check if class is persistence aware, by looking at its annotations.protected org.datanucleus.metadata.AbstractClassMetaDataprocessClassAnnotations(org.datanucleus.metadata.PackageMetaData pmd, Class cls, org.datanucleus.metadata.annotations.AnnotationObject[] annotations, org.datanucleus.ClassLoaderResolver clr)Method to process the "class" level annotations and create the outline ClassMetaData objectprotected voidprocessEmbeddedAttributeOverride(org.datanucleus.metadata.AbstractMemberMetaData mmd, String overriddenName, Class type, javax.persistence.Column column)Method to process the override of embedded members.protected org.datanucleus.metadata.AbstractMemberMetaDataprocessMemberAnnotations(org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.metadata.annotations.Member member, org.datanucleus.metadata.annotations.AnnotationObject[] annotations)Convenience method to process the annotations for a field/property.protected voidprocessMethodAnnotations(org.datanucleus.metadata.AbstractClassMetaData cmd, Method method)Method to take the passed in outline ClassMetaData and process the annotations for method adding any necessary MetaData to the ClassMetaData.protected voidprocessNamedQueries(org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.metadata.annotations.AnnotationObject[] annotations)Convenience method to process NamedQuery, NamedQueries, NamedNativeQuery, NamedNativeQueries, NamedStoredProcedureQueries, NamedStoredProcedureQuery annotations.-
Methods inherited from class org.datanucleus.metadata.annotations.AbstractAnnotationReader
addSupportedDuplicateAnnotations, getAnnotationObjectsForAnnotations, getClassAnnotationsForClass, getFieldAnnotationsForClass, getJavaBeanAccessorAnnotationsForClass, getMetaDataForClass, getSupportedAnnotationPackages, isPersistenceContext, isSupportedAnnotation, setSupportedAnnotationPackages
-
-
-
-
Method Detail
-
processClassAnnotations
protected org.datanucleus.metadata.AbstractClassMetaData processClassAnnotations(org.datanucleus.metadata.PackageMetaData pmd, 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:
processClassAnnotationsin classorg.datanucleus.metadata.annotations.AbstractAnnotationReader- Parameters:
pmd- Parent PackageMetaDatacls- The classannotations- Annotations for this classclr- ClassLoader resolver- Returns:
- The ClassMetaData (or null if no annotations)
-
processNamedQueries
protected void processNamedQueries(org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.metadata.annotations.AnnotationObject[] annotations)Convenience method to process NamedQuery, NamedQueries, NamedNativeQuery, NamedNativeQueries, NamedStoredProcedureQueries, NamedStoredProcedureQuery annotations.- Parameters:
cmd- Metadata for the classannotations- Annotations specified on the class
-
getMetaDataForStoredProcParameter
protected org.datanucleus.metadata.StoredProcQueryParameterMetaData getMetaDataForStoredProcParameter(javax.persistence.StoredProcedureParameter param)
-
processMemberAnnotations
protected org.datanucleus.metadata.AbstractMemberMetaData processMemberAnnotations(org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.metadata.annotations.Member member, org.datanucleus.metadata.annotations.AnnotationObject[] annotations)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:
processMemberAnnotationsin classorg.datanucleus.metadata.annotations.AbstractAnnotationReader- Parameters:
cmd- The ClassMetaData to updatemember- The field/propertyannotations- The annotations for the field/property- Returns:
- The FieldMetaData/PropertyMetaData that was added (if any)
-
processEmbeddedAttributeOverride
protected void processEmbeddedAttributeOverride(org.datanucleus.metadata.AbstractMemberMetaData mmd, String overriddenName, 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 memberoverriddenName- The overridden member within this embedded objecttype- Type of this membercolumn- The column details to override it with
-
processMethodAnnotations
protected void processMethodAnnotations(org.datanucleus.metadata.AbstractClassMetaData cmd, 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:
processMethodAnnotationsin classorg.datanucleus.metadata.annotations.AbstractAnnotationReader- Parameters:
cmd- The ClassMetaData (to be updated)method- The method
-
isClassPersistable
protected org.datanucleus.metadata.annotations.AnnotationObject isClassPersistable(org.datanucleus.metadata.annotations.AnnotationObject[] annotations)
Check if a class is persistable, by looking at its annotations.- Parameters:
annotations- Annotations for the class- Returns:
- The annotation marking this class as an entity (or null if none present)
-
isClassPersistenceAware
protected boolean isClassPersistenceAware(org.datanucleus.metadata.annotations.AnnotationObject[] annotations)
Check if class is persistence aware, by looking at its annotations.- Parameters:
annotations- Annotations for the class- Returns:
- true if the class has @PersistenceAware
-
doesClassHaveNamedQueries
protected boolean doesClassHaveNamedQueries(org.datanucleus.metadata.annotations.AnnotationObject[] annotations)
Check if class has NamedXXXQuery annotations (for classes that are not persistable but provide named query definitions.- Parameters:
annotations- Annotations for the class- Returns:
- true if the class has Named query annotations
-
doesClassHaveConverter
protected boolean doesClassHaveConverter(Class cls, org.datanucleus.metadata.annotations.AnnotationObject[] annotations)
Check if class has Converter annotation by inspecting its annotations.- Parameters:
cls- The classannotations- Annotations for the class- Returns:
- true if the class has Converter annotations
-
-