Package org.eclipse.persistence.internal.jpa.metadata.accessors.objects

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataClass


     * INTERNAL:
     * Called from MappedSuperclassAccessor. We want to avoid setting the
     * class accessor on the descriptor to be the MappedSuperclassAccessor.
     */
    protected ClassAccessor(Annotation annotation, Class cls, MetadataDescriptor descriptor) {   
        super(annotation, new MetadataClass(cls), descriptor, descriptor.getProject());
    }
View Full Code Here


    /**
     * INTERNAL:
     * Add a discovered metamodel class to the session.
     */
    public void addStaticMetamodelClass(MetadataAnnotation annotation, MetadataClass metamodelClass) {
        MetadataClass modelClass = metamodelClass.getMetadataClass((String) annotation.getAttributeString("value"));
       
        m_session.addStaticMetamodelClass(modelClass.getName(), metamodelClass.getName());
    }
View Full Code Here

                iterator = unlistedClasses.iterator();
                unlisted = true;
            }
            if (iterator.hasNext()) {
                String className = iterator.next();
                MetadataClass candidateClass = m_factory.getMetadataClass(className, unlisted);
                // JBoss Bug 227630: Do not process a null class whether it was from a
                // NPE or a CNF, a warning or exception is thrown in loadClass()
                if (candidateClass != null) {
                    if (PersistenceUnitProcessor.isEntity(candidateClass) && ! m_project.hasEntity(candidateClass) && ! m_project.hasEmbeddable(candidateClass)) {
                        m_project.addEntityAccessor(new EntityAccessor(PersistenceUnitProcessor.getEntityAnnotation(candidateClass), candidateClass, m_project));
View Full Code Here

     *      related metadata class.
     *   3- For each round we must update all metadata classes for each round
     *      element.
     */
    public MetadataClass getMetadataClass(Element element) {
        MetadataClass metadataClass = roundElements.get(element);
       
        if (metadataClass == null) {
            // Only log if logging on finest.
            boolean shouldLog = getLogger().getSession().getLogLevel() == SessionLog.FINEST;
            // As a performance gain, avoid visiting this class if it is not a
            // round element. We must re-visit round elements.
            if (isRoundElement(element)) {
                if (shouldLog) {
                    processingEnv.getMessager().printMessage(Kind.NOTE, "Building metadata class for round element: " + element);
                }
                metadataClass = new MetadataClass(MetadataMirrorFactory.this, "");
                roundElements.put(element, metadataClass);
                roundMetadataClasses.add(metadataClass);
               
                // Kick off the visiting of elements.
                element.accept(elementVisitor, metadataClass);
             
                // The name of the metadata class is a qualified name from a
                // type element. Set this name on the MetadataFactory map. We
                // can't call addMetadataClass till we have visited the class.
                addMetadataClass(metadataClass);
            } else {
                String name = element.toString();
                if (metadataClassExists(name))  {
                    return getMetadataClass(name);
                }
                // So we are not a round element, the outcome is as follows:
                //  - TypeElement or TypeParameterElement in existing class map,
                //    return it.
                //  - TypeElement, and not in the existing class map, return
                //    simple non-visited MetadataClass with only a name/type.
                //  - TypeParameterElement, and not in the existing class map,
                //    visit it to ensure we get the correct generic type set
                //    and return it.
                //  - Everything else, return simple non-visited MetadataClass
                //    with only a name/type from the toString value.
                if (element instanceof TypeElement || element instanceof TypeParameterElement) {
                    if (element instanceof TypeElement) {
                        if (shouldLog) {
                            processingEnv.getMessager().printMessage(Kind.NOTE, "Building metadata class for type element: " + name);
                        }
                        metadataClass = new MetadataClass(MetadataMirrorFactory.this, name);
                        addMetadataClass(metadataClass);
                        element.accept(elementVisitor, metadataClass);
                        addMetadataClass(metadataClass);
                    } else {
                        // Only thing going to get through at this point are
                        // TypeParameterElements (presumably generic ones). Look
                        // at those further since they 'should' be simple visits.
                        if (shouldLog) {
                            processingEnv.getMessager().printMessage(Kind.NOTE, "Building type parameter element: " + name);
                        }
                        metadataClass = new MetadataClass(MetadataMirrorFactory.this, name);
                        addMetadataClass(metadataClass);
                        element.accept(elementVisitor, metadataClass);
                        addMetadataClass(metadataClass);
                    }
                } else {
View Full Code Here

            // By the time this method is called we should have built a
            // MetadataClass for all the model elements (and then some) which
            // are the only classes we really care about. This is acting like a
            // catch all for any jdk classes we didn't visit and just returns a
            // MetadataClass with the same class name.
            addMetadataClass(new MetadataClass(this, className));
          }
         
          return getMetadataClasses().get(className);
        }
    }
View Full Code Here

   
    /**
     * Return if a given class is annotated with @Embeddable.
     */
    public static Annotation getEmbeddableAnnotation(Class candidateClass){
        return new MetadataClass(candidateClass).getAnnotation(javax.persistence.Embeddable.class);
    }
View Full Code Here

   
    /**
     * Return if a given class is annotated with @Entity.
     */
    public static Annotation getEntityAnnotation(Class candidateClass){
        return new MetadataClass(candidateClass).getAnnotation(javax.persistence.Entity.class);
    }
View Full Code Here

   
    /**
     * Return if a given class is annotated with @Embeddable.
     */
    public static boolean isEmbeddable(Class candidateClass) {
        return new MetadataClass(candidateClass).isAnnotationPresent(javax.persistence.Embeddable.class);
    }
View Full Code Here

   
    /**
     * Return if a given class is annotated with @Entity.
     */
    public static boolean isEntity(Class candidateClass){
        return new MetadataClass(candidateClass).isAnnotationPresent(javax.persistence.Entity.class);
    }
View Full Code Here

                MappedSuperclassAccessor accessor = getProject().getMappedSuperclass(parent);

                // If the mapped superclass was not defined in XML then check
                // for a MappedSuperclass annotation.
                if (accessor == null) {
                    MetadataClass metadataClass = new MetadataClass(parent);
                    if (metadataClass.isAnnotationPresent(MappedSuperclass.class)) {
                        mappedSuperclasses.add(new MappedSuperclassAccessor(metadataClass.getAnnotation(MappedSuperclass.class), parent, getDescriptor(), getProject()));
                    }
                } else {
                    mappedSuperclasses.add(initXMLMappedSuperclass(accessor, getDescriptor()));
                }
            }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.