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

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


    TreeLogger logger = createLogger();
    TypeOracle to = TypeOracleTestingUtils.buildTypeOracle(logger, resources);

    JClassType sup = to.getType("Sup");
    JClassType sub = to.getType("Sub");
    JPrimitiveType primFloat = JPrimitiveType.FLOAT;

    JArrayType subArray = to.getArrayType(sub);
    JArrayType subArrayArray = to.getArrayType(subArray);
    JArrayType supArray = to.getArrayType(sup);
    JArrayType supArrayArray = to.getArrayType(supArray);
View Full Code Here


  }

  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 "
View Full Code Here

                + "returning Map or Map<String,String>");
      }
    }
    if (intValue != null) {
      constantsCount++;
      JPrimitiveType primType = returnType.isPrimitive();
      if (primType != JPrimitiveType.INT) {
        throw new AnnotationsError(
            "@DefaultIntValue can only be used with a method returning int");
      }
    }
    if (floatValue != null) {
      constantsCount++;
      JPrimitiveType primType = returnType.isPrimitive();
      if (primType != JPrimitiveType.FLOAT) {
        throw new AnnotationsError(
            "@DefaultFloatValue can only be used with a method returning float");
      }
    }
    if (doubleValue != null) {
      constantsCount++;
      JPrimitiveType primType = returnType.isPrimitive();
      if (primType != JPrimitiveType.DOUBLE) {
        throw new AnnotationsError(
            "@DefaultDoubleValue can only be used with a method returning double");
      }
    }
    if (booleanValue != null) {
      constantsCount++;
      JPrimitiveType primType = returnType.isPrimitive();
      if (primType != JPrimitiveType.BOOLEAN) {
        throw new AnnotationsError(
            "@DefaultBooleanValue can only be used with a method returning boolean");
      }
    }
View Full Code Here

      return result;
    JClassType classType = t.isClassOrInterface();
    if(classType != null) {
      result = new JClassTypeWrapper(classType);
    } else {
      JPrimitiveType primitiveType = t.isPrimitive();
      if(primitiveType != null) {
        result = PrimitiveTypeInfo.valueOf(primitiveType.getSimpleSourceName());
      } else {
        result = new JTypeWrapper(t);
      }
    }
    wrapperCache.put(t, result);
View Full Code Here

    if (param == null) {
      return "null";
    } else if (param.getType().isArray() != null) {
      return "array";
    } else if (param.getType().isPrimitive() != null) {
      JPrimitiveType prim = param.getType().isPrimitive();
      return prim == JPrimitiveType.BOOLEAN ? "boolean" : "number";
    } else if (exportableEnclosingType.getExportableTypeOracle()
        .isString(param.getType())) {
      return "string";
    } else if (exportableEnclosingType.getExportableTypeOracle()
View Full Code Here

        if (classReturnType != null && classReturnType == classCollection.stringClass) {
            returnString = true;
        } else {
            returnString = false;

            JPrimitiveType primitiveReturnType = method.getReturnType().isPrimitive();
            if (primitiveReturnType == null
                    || primitiveReturnType != JPrimitiveType.VOID) {
                logger.log(
                        TreeLogger.WARN,
                        "In presenter " + presenterInspector.getPresenterClassName()
View Full Code Here

      if (pluralCount != null) {
        if (pluralParamIndex >= 0) {
          throw error(logger, m.getName()
              + ": there can only be one PluralCount parameter");
        }
        JPrimitiveType primType = params[i].getType().isPrimitive();
        if (primType != JPrimitiveType.INT && primType != JPrimitiveType.SHORT) {
          throw error(logger, m.getName()
              + ": PluralCount parameter must be int or short");
        }
        pluralParamIndex = i;
View Full Code Here

   * Implements {x,number...} references in MessageFormat.
   */
  private static class NumberFormatter implements ValueFormatter {
    public String format(StringGenerator out, String subformat, String argName,
        JType argType) {
      JPrimitiveType argPrimType = argType.isPrimitive();
      if (argPrimType == null || argPrimType == JPrimitiveType.BOOLEAN
          || argPrimType == JPrimitiveType.VOID) {
        return "Illegal argument type for number format";
      }
      if (subformat == null) {
View Full Code Here

    if (classReturnType != null
        && "java.lang.String".equals(classReturnType.getQualifiedSourceName())) {
      returnExpr = "\"" + Generator.escape(def.getValues().get(0).toString())
          + "\"";
    } else {
      JPrimitiveType returnType = toImplement.getReturnType().isPrimitive();
      if (returnType == null) {
        logger.log(TreeLogger.ERROR, toImplement.getName()
            + ": Return type must be primitive type or String for "
            + "@def accessors");
        throw new UnableToCompleteException();
      }
      if (returnType == JPrimitiveType.INT || returnType == JPrimitiveType.LONG) {
        returnExpr = "" + Math.round(numberValue.getValue());
      } else if (returnType == JPrimitiveType.FLOAT) {
        returnExpr = numberValue.getValue() + "F";
      } else if (returnType == JPrimitiveType.DOUBLE) {
        returnExpr = "" + numberValue.getValue();
      } else {
        logger.log(TreeLogger.ERROR, returnType.getQualifiedSourceName()
            + " is not a valid primitive return type for @def accessors");
        throw new UnableToCompleteException();
      }
    }
    sw.print(toImplement.getReadableDeclaration(false, false, false, false,
View Full Code Here

    if (typeParameterized != null) {
      endVisit(typeParameterized);
      return;
    }

    JPrimitiveType typePrimitive = type.isPrimitive();
    if (typePrimitive != null) {
      endVisit(typePrimitive);
      return;
    }
View Full Code Here

TOP

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

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.