Package com.google.gwt.core.ext.typeinfo

Examples of com.google.gwt.core.ext.typeinfo.JArrayType


                    writer.println("        }");
                    writer.println("    }");
                }

            } else if (property.isArray() && BeanGeneratorUtils.isBean(property.getType().isArray().getComponentType())) {
                JArrayType arrayType = property.getType().isArray();
                String componentTypeName = arrayType.getComponentType().getQualifiedSourceName();
                writer.println("    if (propVal != null) {");
                String arrayVar = nextVarName();
                writer.println("        " + componentTypeName + "[] " + arrayVar + " = (" + componentTypeName + "[]) propVal;");
                writer.println("        for (int i = 0; i < " + arrayVar + ".length; i++) {");
                writer.println("            BeanInfo subBeanInfo = BeanInfoRegistry.get().getBeanInfo(" + componentTypeName + ".class);");
View Full Code Here


                writer.println(this.setterPrefix(prop) + "null);");
                writer.println("} else {");
            }

            if(prop.getType().isArray() != null){
                JArrayType arrayType = prop.getType().isArray();
                JType paramType = arrayType.getComponentType();
                writer.println("JSONArray array = root.get(\"" + fieldName +
                    "\").isArray();");
                writer.println( paramType.getQualifiedSourceName()+"[] value = new "+
                        paramType.getQualifiedSourceName()+"[ array.size() ];");
                writer.println("for(int i=0; i<array.size(); i++){");
View Full Code Here

            String fieldName = (field == null) ? prop.getName() : field.value();

            if (prop.getReadMethod() != null) {
                JClassType classType = prop.getType().isClassOrInterface();
                JArrayType arrayType = prop.getType().isArray();
                System.out.println(prop.getName()+ "  ArrayType "+arrayType +" :: "+((arrayType == null ? "" : ""+arrayType.getComponentType())));
                if ((classType != null) &&
                        (classType.isAssignableTo(this.collectionType)) ||
                        arrayType != null) {
                    JType subType = (arrayType != null)
                        ? arrayType.getComponentType()
                        : classType.asParameterizationOf(this.collectionType.isGenericType())
                                   .getTypeArgs()[0];
                    writer.println();
                    writer.println(" if( source." +
                        prop.getReadMethod().getBaseMethod().getName() +
View Full Code Here

    name += type.getName().replace('.', '$');
    return name;
  }

  private String getBinaryOrPrimitiveName(JType type) {
    JArrayType asArray = type.isArray();
    JClassType asClass = type.isClassOrInterface();
    JPrimitiveType asPrimitive = type.isPrimitive();
    if (asClass != null) {
      return getBinaryName(asClass);
    } else if (asPrimitive != null) {
      return asPrimitive.getQualifiedSourceName();
    } else if (asArray != null) {
      JType componentType = asArray.getComponentType();
      return getBinaryOrPrimitiveName(componentType) + "[]";
    } else {
      throw new InternalCompilerException("Cannot create binary name for "
          + type.getQualifiedSourceName());
    }
View Full Code Here

    JPrimitiveType primitiveType = type.isPrimitive();
    if (primitiveType != null) {
      return primitiveType.getJNISignature();
    }

    JArrayType arrayType = type.isArray();
    if (arrayType != null) {
      JType component = arrayType.getComponentType();
      if (component.isClassOrInterface() != null) {
        return "[L" + computeBinaryClassName(arrayType.getComponentType())
            + ";";
      } else {
        return "[" + computeBinaryClassName(arrayType.getComponentType());
      }
    }

    JParameterizedType parameterizedType = type.isParameterized();
    if (parameterizedType != null) {
View Full Code Here

      }
    }

    private void generateCompareValue(String fieldName,
        JType type, String firstValue, String secondValue) {
      JArrayType arrayType = type.isArray();
      if(arrayType != null) {
        JType eltType = type.isArray().getComponentType();
        generateCompareArray(fieldName, firstValue, secondValue,
            eltType);
      } else {
View Full Code Here

        || type.getQualifiedSourceName().startsWith("java.lang.")
        || type.getQualifiedSourceName().startsWith("java.math."))
        return copyValue;
     
      // Deep copy arrays
      JArrayType array = type.isArray();
      if(array != null) {
        String arrayTypeName = array.getParameterizedQualifiedSourceName();
        String compTypeName = array.getComponentType().getParameterizedQualifiedSourceName();
        String arrayName = "dest"+capFieldName;
        sw.println(arrayTypeName+" src"+capFieldName+" = "+copyValue+";");
        sw.println(arrayTypeName+" "+arrayName+";");
        sw.println("if(src"+capFieldName+" != null) {");
        sw.indent();
        sw.println(arrayName+" = new "+compTypeName+"[src"+capFieldName+".length];");
        sw.println("int "+arrayName+"Count = 0;");
        sw.println("for(int i=0; i < "+arrayName+".length; i++) {");
        sw.indent();
        sw.println(arrayName+"[i] = "+copyField(array.getComponentType(), "src"+capFieldName+"[i]", capFieldName+"Elt")+";");
        sw.outdent();
        sw.println("}");
        sw.outdent();
        sw.println("} else {");
        sw.indentln(arrayName+" = null;");
View Full Code Here

    JPrimitiveType primitiveType = type.isPrimitive();
    if (primitiveType != null) {
      return primitiveType.getJNISignature();
    }

    JArrayType arrayType = type.isArray();
    if (arrayType != null) {
      JType component = arrayType.getComponentType();
      if (component.isClassOrInterface() != null) {
        return "[L" + computeBinaryClassName(arrayType.getComponentType())
            + ";";
      } else {
        return "[" + computeBinaryClassName(arrayType.getComponentType());
      }
    }

    JParameterizedType parameterizedType = type.isParameterized();
    if (parameterizedType != null) {
View Full Code Here

    name += type.getName().replace('.', '$');
    return name;
  }

  private String getBinaryOrPrimitiveName(JType type) {
    JArrayType asArray = type.isArray();
    JClassType asClass = type.isClassOrInterface();
    JPrimitiveType asPrimitive = type.isPrimitive();
    if (asClass != null) {
      return getBinaryName(asClass);
    } else if (asPrimitive != null) {
      return asPrimitive.getQualifiedSourceName();
    } else if (asArray != null) {
      JType componentType = asArray.getComponentType();
      return getBinaryOrPrimitiveName(componentType) + "[]";
    } else {
      throw new InternalCompilerException("Cannot create binary name for "
          + type.getQualifiedSourceName());
    }
View Full Code Here

    return MetaClassFactory.get(type.getSuperclass());
  }

  @Override
  public MetaClass getComponentType() {
    JArrayType type = getEnclosedMetaObject().isArray();
    if (type == null) {
      return null;
    }
    return MetaClassFactory.get(type.getComponentType());
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.typeinfo.JArrayType

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.