Package org.objectweb.jorm.type.api

Examples of org.objectweb.jorm.type.api.PType


        Iterator it = sc.fields.values().iterator();
        while(it.hasNext()) {
            SpeedoField sf = (SpeedoField) it.next();
            if (sf.primaryKey) {
        java.lang.Class fieldType;
        PType fieldPType;
        if ("java.lang.Long".equals(sf.type()) || "Long".equals(sf.type())) {
          fieldType = Long.class;
          fieldPType = PTypeSpace.OBJLONG;
        } else if ("long".equals(sf.type())) {
          fieldType = Long.TYPE;
View Full Code Here


                }
            }
      // create a hidden field in the class corresponding to this
      // composite Name field. The name is based on a prefix (ClassRef name)
            String fieldName = prefix + pkField.name;
            PType type = mibh.getPrimitivePType(Type.getType(pkField.type));
      if (logger.isLoggable(BasicLevel.DEBUG)) {
        logger.log(BasicLevel.DEBUG, "\tField: name=" + fieldName
                + ", type=" + type.getJavaName());
      }
            mibh.createNameDefField(cr.getParent(), fieldName, type, size, scale);
            //define the projection between composite name fields and field used
            // in NameRef
            nr.addProjection(pkField.name, fieldName);
View Full Code Here

            String fieldName = prefix + pkField.name;
      if (logger.isLoggable(BasicLevel.DEBUG)) {
        logger.log(BasicLevel.DEBUG, "\tField: name=" + fieldName);
      }
            if (isGCId) {
                PType type = mibh.getPrimitivePType(Type.getType(pkField.type));
                int size = PType.NOSIZE;
                int scale = PType.NOSIZE;
                if (pkField.columns != null && pkField.columns.length == 1) {
                    if (pkField.columns[0].length != -1) {
                        size = pkField.columns[0].length;
View Full Code Here

   
    /**
     * Computes the type of a field.
     */
    private Class getFieldClass(Field field) throws SpeedoException {
        PType ptype = field.getType();
        String className = null;
        switch(ptype.getTypeCode()) {
        case PType.TYPECODE_BIGDECIMAL:
            return BigDecimal.class;
        case PType.TYPECODE_BIGINTEGER:
            return BigInteger.class;
        case PType.TYPECODE_BOOLEAN:
        case PType.TYPECODE_OBJBOOLEAN:
            return Boolean.class;
        case PType.TYPECODE_BYTE:
        case PType.TYPECODE_OBJBYTE:
            return Byte.class;
        case PType.TYPECODE_BYTEARRAY:
            return Byte[].class;
        case PType.TYPECODE_CHAR:
        case PType.TYPECODE_OBJCHAR:
            return Character.class;
        case PType.TYPECODE_CHARARRAY:
            return Character[].class;
        case PType.TYPECODE_DATE:
            return Date.class;
        case PType.TYPECODE_DOUBLE:
        case PType.TYPECODE_OBJDOUBLE:
            return Double.class;
        case PType.TYPECODE_FLOAT:
        case PType.TYPECODE_OBJFLOAT:
            return Float.class;
        case PType.TYPECODE_INT:
        case PType.TYPECODE_OBJINT:
            return Integer.class;
        case PType.TYPECODE_LONG:
        case PType.TYPECODE_OBJLONG:
            return Long.class;
        case PType.TYPECODE_SERIALIZED:
            return Serializable.class;
        case PType.TYPECODE_SHORT:
        case PType.TYPECODE_OBJSHORT:
            return Integer.class;
        case PType.TYPECODE_STRING:
            return String.class;

        case PType.TYPECODE_REFERENCE:
            if (field instanceof PropagatedField) {
                Field f = ((PropagatedField) field).getOriginFields()[0];
                if (f instanceof PNameField) {
                    PNameField pnf = (PNameField) f;
                    if (pnf.isClassPName()) {
                        if (pnf.isInGenClass()) {
                            //identifier of the genclass
                            className = pnf.getGenClassRef().getGenClassId();
                        } else {
                            //identifier of a class
                            className = pnf.getMetaObjectClass().getFQName();
                        }
                    } else {
                        Reference ref = pnf.getReference();
                        if (ref instanceof ClassRef) {
                            //reference to a class
                            className = ((ClassRef) ref).getMOClass().getFQName();
                        } else if (ref instanceof GenClassRef) {
                            //reference to a genclass
                            className = ((GenClassRef) ref).getGenClassId();
                        }
                    }
                }
            }
            break;
        default:
            className = ptype.getJavaName();
        }
        if (className == null) {
            throw new SpeedoException(
                    "Type '" + ptype.getJavaName()
                    + "' not found for projected field:"
                    + field.getName());
        } else {
            try {
                return classloader.loadClass(className);
View Full Code Here

        }
        if ("Integer".equals(name)) {
            return PTypeSpace.OBJINT;
        }
        for (int i = 0; i < PTypeSpace.PREDEFINEDPTYPES.length; i++) {
            PType type = PTypeSpace.PREDEFINEDPTYPES[i];
            if (type.getJavaName().equals(name)
                || type.getJormName().equals(name)) {
                return type;
            }
        }
        if ("Collection".equals(name)
                || PTypeSpace.COLLECTION.getJavaName().equals(name)) {
View Full Code Here

        for (int i = 0; i < op.getOperandNumber(); i++) {
          if (op.getExpression(i) instanceof DummyOperand) {
            //get the other child operand
            int j = (i+1) % 2;
            Expression other = op.getExpression(j);
            PType ptype = other.getType();
            if (ptype.getTypeCode() == PType.TYPECODE_REFERENCE) {
              PName val = null;
              try {
                val = jf.getPClassMapping(ptype.getJormName(), clazz.getClassLoader()).getPBinder().getNull();
              } catch (Exception e) {
                throw new SpeedoException(
                    "Try to replace null node. Impossible to find the null PName for the type " + ptype.getJormName(), e);
              }
              //replace the null node with null PName
              op.setExpression(i, new BasicOperand(val, ptype));
            } else {
                //Transform the null [not]equality into a IsNull operator
View Full Code Here

      pn = pn.resolve(context);
      if (logger.isLoggable(BasicLevel.DEBUG)) {
        logger.log(BasicLevel.DEBUG, "newInstance(" + oid + "): pn.resolve=" + pn);
        logger.log(BasicLevel.DEBUG, "newInstance(" + oid + "): pn.type=" + pn.getPType());
      }
      PType type = pn.getPType();
      if (type == null) {
        //Error detected by Roland Hedayat
        throw new PersistenceException("newInstance() "
          + "\n\toid=" + oid
          + "\n\tpn=" + pn
          + "\n\tpn.pnc=" + (pn.getPNameManager() != null ? pn.getPNameManager() : null));
      }
      className = type.getJormName();
      int idx = className.indexOf(JormPathHelper.SEP);
      PClassMapping pcm = ((PBinder) pn.getPNameManager())
          .getBinderClassMapping();
      PersistentObjectItf sp = null;
      if ((pcm instanceof AbstractGenClassHome) && idx != -1) {
View Full Code Here

        } else if (actions[0].equals(NamingManager.PNH_REF_STATE)) {
            generateGetRefState(mv, false);
       
        } else if (actions[0].equals(NamingManager.PNH_PFIELD)) {
            final PType pt = (PType) actions[2];
            final String fieldName = (String) actions[1];
            final String jvmFieldType = getJVMType(pt);
            final String wrapper = getJavaWrapper(pt);
            if (wrapper != null) {
                mv.visitTypeInsn(NEW, wrapper);
View Full Code Here

TOP

Related Classes of org.objectweb.jorm.type.api.PType

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.