Class JakartaAnnotationReader

  • All Implemented Interfaces:
    org.datanucleus.metadata.annotations.AnnotationReader

    public class JakartaAnnotationReader
    extends org.datanucleus.metadata.annotations.AbstractAnnotationReader
    Implementation for Annotation Reader for Java annotations using Jakarta Persistence definition. This reader also accepts certain DataNucleus extensions where the Jakarta Persistence annotations don't provide full definition of the data required.
    • Field Summary

      • Fields inherited from class org.datanucleus.metadata.annotations.AbstractAnnotationReader

        mmgr, supportedDuplicateAnnotations, supportedPackages
    • Constructor Summary

      Constructors 
      Constructor Description
      JakartaAnnotationReader​(org.datanucleus.metadata.MetaDataManager mgr)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean doesClassHaveConverter​(Class cls, org.datanucleus.metadata.annotations.AnnotationObject[] annotations)
      Check if class has Converter annotation by inspecting its annotations.
      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.
      protected org.datanucleus.metadata.StoredProcQueryParameterMetaData getMetaDataForStoredProcParameter​(jakarta.persistence.StoredProcedureParameter param)  
      protected org.datanucleus.metadata.annotations.AnnotationObject isClassPersistable​(org.datanucleus.metadata.annotations.AnnotationObject[] annotations)
      Check if a class is persistable, by looking at its annotations.
      protected boolean isClassPersistenceAware​(org.datanucleus.metadata.annotations.AnnotationObject[] annotations)
      Check if class is persistence aware, by looking at its annotations.
      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
      protected void processEmbeddedAttributeOverride​(org.datanucleus.metadata.AbstractMemberMetaData mmd, String overriddenName, Class type, jakarta.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)
      Convenience method to process the annotations for a field/property.
      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.
      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.
      • Methods inherited from class org.datanucleus.metadata.annotations.AbstractAnnotationReader

        addSupportedDuplicateAnnotations, getAnnotationObjectsForAnnotations, getClassAnnotationsForClass, getFieldAnnotationsForClass, getJavaBeanAccessorAnnotationsForClass, getMetaDataForClass, getSupportedAnnotationPackages, isPersistenceContext, isSupportedAnnotation, setSupportedAnnotationPackages
    • Constructor Detail

      • JakartaAnnotationReader

        public JakartaAnnotationReader​(org.datanucleus.metadata.MetaDataManager mgr)
        Constructor.
        Parameters:
        mgr - MetaData manager
    • 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:
        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)
      • 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 class
        annotations - Annotations specified on the class
      • getMetaDataForStoredProcParameter

        protected org.datanucleus.metadata.StoredProcQueryParameterMetaData getMetaDataForStoredProcParameter​(jakarta.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:
        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
        Returns:
        The FieldMetaData/PropertyMetaData that was added (if any)
      • processEmbeddedAttributeOverride

        protected void processEmbeddedAttributeOverride​(org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                        String overriddenName,
                                                        Class type,
                                                        jakarta.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,
                                                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
      • 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 class
        annotations - Annotations for the class
        Returns:
        true if the class has Converter annotations