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

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


            // Initialize the class with the package from entity mappings.
            Class entityClass = getClassForName(entity.getClassName());
           
            // Initialize the entity with its metadata descriptor and
            // project.
            entity.initXMLClassAccessor(new MetadataClass(entityClass, this), new MetadataDescriptor(entityClass, entity), m_project);
           
            if (allEntities.containsKey(entityClass.getName())) {
                // Merge this entity with the existing one.
                allEntities.get(entityClass.getName()).merge(entity);
            } else {
                // Add this entity to the map.
                allEntities.put(entityClass.getName(), entity);
            }
        }
       
        // Process the embeddables.
        for (EmbeddableAccessor embeddable : getEmbeddables()) {
            // Initialize the class with the package from entity mappings.
            Class embeddableClass = getClassForName(embeddable.getClassName());
           
            // Initialize the embeddable with its metadata descriptor and
            // project.
            embeddable.initXMLClassAccessor(new MetadataClass(embeddableClass, this), new MetadataDescriptor(embeddableClass, embeddable), m_project);
           
            if (allEmbeddables.containsKey(embeddableClass.getName())) {
                // Merge this embeddable with the existing one.
                allEmbeddables.get(embeddableClass.getName()).merge(embeddable);
            } else {   
                // Add this embeddable to the map.
                allEmbeddables.put(embeddableClass.getName(), embeddable);
            }
        }
       
        // Process the mapped superclasses
        for (MappedSuperclassAccessor mappedSuperclass : getMappedSuperclasses()) {
            // Initialize the class with the package from entity mappings.
            Class mappedSuperclassClass = getClassForName(mappedSuperclass.getClassName());
           
            // Just set the accessible object on the mapped superclass for now.
            // Mapped superclasses are reloaded for each entity that inherits
            // from it. After each reload, the initXMLObjects is called and
            // ready to be processed there after.
            mappedSuperclass.setAccessibleObject(new MetadataClass(mappedSuperclassClass, this));
           
            // Add it to the project. This will merge it if necessary.
            m_project.addMappedSuperclass(mappedSuperclassClass.getName(), mappedSuperclass);
        }
    }
View Full Code Here


        xmlEntityMappings = reloadXMLEntityMappingsObject(xmlEntityMappings);
           
        // Initialize the newly loaded/built entity
        EntityAccessor entity = xmlEntityMappings.getEntities().get(0);
        Class entityClass = getClassForName(entity.getClassName());
        entity.initXMLClassAccessor(new MetadataClass(entityClass, this), descriptor, m_project);
           
        return entity;
    }
View Full Code Here

        xmlEntityMappings = reloadXMLEntityMappingsObject(xmlEntityMappings);
       
        // Initialize the newly loaded/built mapped superclass
        MappedSuperclassAccessor mappedSuperclass = xmlEntityMappings.getMappedSuperclasses().get(0);
        Class mappedSuperclassClass = getClassForName(mappedSuperclass.getClassName());
        mappedSuperclass.initXMLClassAccessor(new MetadataClass(mappedSuperclassClass, this), descriptor, m_project);
       
        return mappedSuperclass;
    }
View Full Code Here

            // for this persistence unit. Its inclusion therefore in this
            // persistence unit is through the use of an Embedded annotation
            // or an embedded element within a known entity. Therefore validate
            // that the reference class does indeed have an Embeddable
            // annotation.
            MetadataClass metadataClass = new MetadataClass(getReferenceClass());
            if (metadataClass.isAnnotationNotPresent(Embeddable.class)) {   
                throw ValidationException.invalidEmbeddedAttribute(getJavaClass(), getAttributeName(), getReferenceClass());
            } else {
                accessor = new EmbeddableAccessor(metadataClass.getAnnotation(Embeddable.class), getReferenceClass(), getProject());
                getProject().addEmbeddableAccessor(accessor);
            }
        }
       
        if (accessor.isProcessed()) {
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)) {
                        m_mappedSuperclasses.add(new MappedSuperclassAccessor(metadataClass.getAnnotation(MappedSuperclass.class), parent, getDescriptor()));
                    }
                } else {
                    m_mappedSuperclasses.add(reloadMappedSuperclass(accessor, getDescriptor()));
                }
            }
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

   
    /**
     * INTERNAL:
     */
    public ClassAccessor(Annotation annotation, Class cls, MetadataProject project) {
        super(annotation, new MetadataClass(cls), new MetadataDescriptor(cls), project);
       
        // Set the class accessor reference on the descriptor.
        getDescriptor().setClassAccessor(this);
    }
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.