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

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


   
    /**
     * 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


     * 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, MetadataProject project) {
        super(annotation, new MetadataClass(cls), descriptor, project);
    }
View Full Code Here

            } else {
                // Validate our pk contains their pk.
                getOwningDescriptor().validateDerivedPKClassId(getAttributeName(), referencePKClassName, getReferenceClassName());
            }
        } else {
            MetadataClass type = null;
            if (referenceDescriptor.getClassAccessor().hasDerivedId()){
                // Referenced object has a derived ID but no PK class defined,
                // so it must be a simple pk type. Recurse through to get the
                // simple type
                type = ((ObjectAccessor) referenceDescriptor.getAccessorFor(referenceDescriptor.getIdAttributeName())).getSimplePKType();
            } else {
                // Validate on their basic mapping.
                type = referenceDescriptor.getAccessorFor(referenceDescriptor.getIdAttributeName()).getRawClass();
            }
           
            getOwningDescriptor().validateDerivedPKClassId(getAttributeName(), getBoxedType(type.getName()), getReferenceClassName());
        }

        // Store the Id attribute name. Used with validation and OrderBy.
        getOwningDescriptor().addIdAttributeName(getAttributeName());
View Full Code Here

            // 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

                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

    /**
     * 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

   
    /**
     * 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

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.