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

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


    return Long.toString(crc.getValue());
  }

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

    JArrayType arrayType = type.isArray();
    if (arrayType != null) {
      JType component = arrayType.getComponentType();
View Full Code Here


    if (arrayType == null) {
      return null;
    }

    JType componentType = arrayType.getComponentType();
    JPrimitiveType primitiveType = componentType.isPrimitive();
    String qualifiedSerializerName = DEFAULT_BUILTIN_CUSTOM_SERIALIZER_PACKAGE_NAME
        + ".";
    if (primitiveType != null) {
      qualifiedSerializerName += primitiveType.getSimpleSourceName();
    } else {
      qualifiedSerializerName += typeOracle.getJavaLangObject().getSimpleSourceName();
    }
    qualifiedSerializerName += "_Array_CustomFieldSerializer";
View Full Code Here

      logger.log(TreeLogger.ERROR, "The define named " + name
          + " does not define a numeric value");
      throw new UnableToCompleteException();
    }

    JPrimitiveType returnType = toImplement.getReturnType().isPrimitive();
    assert returnType != null;

    sw.print(toImplement.getReadableDeclaration(false, false, false, false,
        true));
    sw.println(" {");
    sw.indent();
    if (returnType == JPrimitiveType.INT || returnType == JPrimitiveType.LONG) {
      sw.println("return " + Math.round(numberValue.getValue()) + ";");
    } else if (returnType == JPrimitiveType.FLOAT) {
      sw.println("return " + numberValue.getValue() + "F;");
    } else if (returnType == JPrimitiveType.DOUBLE) {
      sw.println("return " + numberValue.getValue() + ";");
    } else {
      logger.log(TreeLogger.ERROR, returnType.getQualifiedSourceName()
          + " is not a valid return type for @def accessors");
      throw new UnableToCompleteException();
    }
    sw.outdent();
    sw.println("}");
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

  }

  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

    }
    return NO_ANNOTATIONS;
  }

  private String getQualifiedSourceNonPrimitiveType(JType elementType) {
    JPrimitiveType primitive = elementType.isPrimitive();
    return primitive == null ? elementType.getQualifiedSourceName()
        : primitive.getQualifiedBoxedSourceName();
  }
View Full Code Here

  private static final JClassType[] NO_JCLASSES = new JClassType[0];
  private static final Pattern PATTERN_WHITESPACE = Pattern.compile("\\s");

  public static String computeBinaryClassName(JType type) {
    JPrimitiveType primitiveType = type.isPrimitive();
    if (primitiveType != null) {
      return primitiveType.getJNISignature();
    }

    JArrayType arrayType = type.isArray();
    if (arrayType != null) {
      JType component = arrayType.getComponentType();
View Full Code Here

    return type.isPrimitive() != null;
  }

  @Override
  String defaultValue(TypeOracle oracle, JType type) {
    JPrimitiveType returnType = type.isPrimitive();

    if (returnType.equals(JPrimitiveType.BOOLEAN)) {
      return "false";

    } else if (returnType.equals(JPrimitiveType.CHAR)) {
      return "32";

    } else {
      return "0";
    }
View Full Code Here

      throws UnableToCompleteException {
    context.parentLogger.branch(TreeLogger.DEBUG,
        "Building primitive value getter statement", null);
    SourceWriter sw = context.sw;
    String argName = context.parameterName;
    JPrimitiveType primitiveType = context.returnType.isPrimitive();
    // Map boolean values that are undefined or null to false
    if (primitiveType != null && primitiveType.equals(JPrimitiveType.BOOLEAN)) {
      sw.print("!!" + argName);
    } else {
      sw.print(argName);
    }
  }
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

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.