Examples of TypedElement


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

  implements NamingManager {

  private final static String SINGLE_USER_ID = "suid";

    private int getCodingType(String fn, MetaObject mo) {
        TypedElement te = null;
        if (mo instanceof Class) {
            te = ((Class) mo).getTypedElement(fn);
        } else if (mo instanceof GenClassRef) {
            te = ((GenClassRef) mo).getHiddenField(fn);
        } else {
            return -1;
        }
        return CTHelper.ptc2ct(te.getType().getTypeCode());
    }
View Full Code Here

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

                SpeedoField sp,
                int nbField,
                Map ctx) throws SpeedoException {
    SpeedoClass moClass = sp.moClass;
    f.name = sp.name;
    TypedElement te = moClass.jormclass.getTypedElement(f.name);
    f.type = sp.type();
        f.jvmType = sp.type;
    f.nameUpperFirst = Character.toUpperCase(f.name.charAt(0))
      + f.name.substring(1);
    f.number = sp.number;
    f.getter = NamingRules.getterName(sp.moClass, sp.name);
    f.setter = NamingRules.setterName(sp.moClass, sp.name);
    f.isClassical = isClassicalType(sp.type());
    f.modifier = sp.modifier();
    f.isKey = sp.primaryKey;
    f.jormmeth = jormTools.upperFL(te.getName());
    f.jormfield = te.getName();
    f.isNotauthorizedToBeNull = (sp.nullValue == SpeedoNullValue.EXCEPTION);
    f.declaration = sp.publicSignature();
    f.defaultFetchGroup = sp.defaultFetchGroup;
    String cacheName = sp.getExtensionValueByKey(SpeedoProperties.USER_CACHE);
    if (cacheName != null) {
        f.userCacheNames = Collections.singleton(cacheName);
    } else {
        f.userCacheNames = Collections.EMPTY_SET;
    }

    // looks for identity type of the field and tests if it is an array
    Type fieldType = Type.getReturnType(sp.type);
    if (!f.isClassical && fieldType.getSort() == Type.OBJECT) {
      SpeedoClass jdoclass = scp.smi.getSpeedoClass(
        fieldType.getClassName(),
        sp.moClass.moPackage.xmlDescriptor);
      if (jdoclass != null) {
        f.isContainerId = jdoclass.identity.isDataStore();
      } else {
        f.isContainerId = true;
      }
      f.isArray = false;
    } else {
      f.isArray = sp.jdoTuple instanceof SpeedoArray;
    }

    f.jormMeth = jormTools.upperFL(f.name);

    //Field Id
    f.jormFieldIdLongPos = sp.number / 64;
    f.jormFieldId = 1L << (sp.number % 64);
    f.jormFielIdDecl = "new long[]{";
    String sep = "";
    for (int i = 0; i <= (nbField / 64); i++) {
      f.jormFielIdDecl += sep + (i == f.jormFieldIdLongPos
        ? f.jormFieldId + "L" : "0L");
      sep = ", ";
    }
    f.jormFielIdDecl += "}";

    f.isReference = jormTools.isReference(te);
    if (f.isReference) { //reference field
      fillReferenceInfo(f, sp, te, ctx, fieldType);
    } else { //primitive field
      f.jormType = te.getType().getJavaName();
      f.memoryType = sp.type();
      f.jormcast = sp.type();
        f.toMemory = "val";
      if (te.getType().getTypeCode() == PType.TYPECODE_SERIALIZED) {
          f.toMemory = "(" + f.memoryType + ")" + f.toMemory;
      }
      f.toStorage = f.name;
      fillUserFieldMappingInfo(f, sp);
    }
View Full Code Here

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

        ArrayList fields = new ArrayList();
        Iterator it = sc.fields.values().iterator();
        while(it.hasNext()) {
            SpeedoField sf = (SpeedoField) it.next();
            if (sf.primaryKey) {
                TypedElement te = sc.jormclass.getTypedElement(sf.name);
                Field f = new Field(sf.name, te.getType().getJavaName());
                String encode = f.name;
                String decode = "current.substring("
                        + (f.name.length() + 1) + " ,(idx = current.indexOf(\";\")))";
                f.next = "current = current.substring(idx+1);";
                switch(te.getType().getTypeCode()) {
                case PType.TYPECODE_BOOLEAN:
                    f.defaultValue = "false";
                    f.decode = "Boolean.getBoolean(" + decode + ")";
                    break;
                case PType.TYPECODE_CHAR:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.