Package org.objectweb.jorm.metainfo.api

Examples of org.objectweb.jorm.metainfo.api.GenClassMapping


              + sp.name + " / javatype: " + javatype
              + " / innerType: " + innerType
            + " / ptype=" + (type == null ? null : type.getJavaName()));
              }
                GenClassRef gcr = clazz.createGenClassRef(sp.name, javatype);
                GenClassMapping gcm = null;
                ClassRef cr = null;
                SpeedoClass tsc = null;

                //element of the gen class
                if (type != null) {
                    // gen class of primitive type
                    gcr.createPrimitiveElement(type, PType.NOSIZE, PType.NOSIZE);
                } else if (!isGenClassRef(innerType)) {
                    // gen class of classref
                    tsc = sc.moPackage.xmlDescriptor.smi
                            .getSpeedoClass(innerType, sc.moPackage);
                    if (tsc == null) {
                        throw new SpeedoException("The persistent class '"
                                + sc.getFQName()
                                + "' tries to reference (througth the field '"
                                + sp.name
                                + "') the class '" + innerType
                                + "' not defined in the .jdo file '"
                                + sc.moPackage.xmlDescriptor.xmlFile + "'");
                    }
                    Class tclass = manager.getClass(tsc.getFQName());
                    if (tclass == null) {
                        throw new SpeedoException("The inner element class '"
                            + tsc.getFQName() + "' of the multivalued field '"
                            + sp.name + "' of the class '" + sc.getFQName()
                            + "' in the .jdo file '"
                            + sc.moPackage.xmlDescriptor.xmlFile
                                + "' has not been found among the persitent classes : "
                            + manager.getClasses());
                    }
                    cr = gcr.createClassRef(tclass);
                } else {
                    throw new SpeedoException(
                            "unmanaged the inner-element of the field '"
                            + sp.name + "' of the class '" + sc.getFQName()
                            + "' : " + innerType);
                }
                //Map the element of the generic class
                if (mapping != null) {
                    gcm = mb.createGenClassMapping(gcr, sp, mapping);
                    if (gcr.isPrimitive()) {
                        mb.createGenClassElementMapping(gcr.getPrimitiveElement(), sp, gcm);
                    } else {
                        NameDef elemNd = cr.createRefNameDef();
                        nmf.getNamingManager(tsc).defineClassReferenceNameDef(elemNd, cr, sp, sc, gcm, this, mb);
                        //fillNameDef(elemNd, tsc, sc, gcr, gcr, gcm, mb, false, true, true, createdMOs);
                        gcm.createReferenceMapping(sp.name, elemNd);
                        cm.addDependency(tsc.getFQName());
                    }
                }

                // reference to a generic class from the class
                NameDef refNd = gcr.createRefNameDef();
                nmf.getNamingManager(sc).defineGenClassReferenceNameDef(refNd, gcr, sp, sc, cm, this, mb);
                //fillNameDef(refNd, sc, sc, clazz, gcr, cm, mb, false, false, false, createdMOs);
                if (cm != null) {
                    cm.createReferenceMapping(sp.name, refNd);
                }

                //identifier of the gen class
                NameDef gcidNd = gcr.createIdNameDef();
                nmf.getNamingManager(sc).defineGenClassIdentifierNameDef(
                        gcidNd, gcr, sp, sc, gcm, this, mb);
                //fillNameDef(gcidNd, sc, sc, gcr, gcr, gcm, mb, true, true, true, createdMOs);
                if (gcm != null) {
                    gcm.createIdentifierMapping(gcidNd);
                }

                //index of the gen class
                java.lang.Class gcClass;
                try {
View Full Code Here


    }

    private GenClassMapping getGenClassMapping(GenClassRef gcr, Class clazz)
            throws SpeedoException {
        String gcid = gcr.getGenClassId();
        GenClassMapping gcm = getMapping(clazz).getGenClassMapping(gcid);
        if (gcm == null) {
            Class klass = clazz;
            Collection superclasses = klass.getSuperClasses();
            while (gcm == null && !superclasses.isEmpty()) {
                klass = (Class) superclasses.iterator().next();
View Full Code Here

TOP

Related Classes of org.objectweb.jorm.metainfo.api.GenClassMapping

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.