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

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


    try {
      assert (type != null);
      assert (serializationOracle.isSerializable(type) || deserializationOracle
          .isSerializable(type));

      JParameterizedType parameterizedType = type.isParameterized();
      if (parameterizedType != null) {
        createFieldSerializer(logger, ctx, parameterizedType.getRawType());
        return;
      }

      /*
       * Only a JClassType can reach this point in the code. JPrimitives have
View Full Code Here


    /*
     * Binder fields are always declared raw, so we're cheating if the user is
     * playing with parameterized types. We're happy enough if the raw types
     * match, and rely on them to make sure the specific types really do work.
     */
    JParameterizedType parameterized = possibleSupertype.isParameterized();
    if (parameterized != null) {
      return isElementAssignableTo(elem, parameterized.getRawType());
    }

    JClassType fieldtype = findFieldType(elem);
    if (fieldtype == null) {
      return false;
View Full Code Here

      SourceWriter sw = f.createSourceWriter(generatorContext, out);

      // Set the now-calculated simple source name
      resourceContext.setSimpleSourceName(generatedSimpleSourceName);

      JParameterizedType hashMapStringResource = getHashMapStringResource(typeOracle);
      String resourceMapField = fields.define(hashMapStringResource, "resourceMap");

      // Write a static instance for use by the static initializers.
      sw.print("private static " + generatedSimpleSourceName + " ");
      sw.println(INSTANCE_NAME + " = new " + generatedSimpleSourceName + "();");
View Full Code Here

    assert hashMap != null;
    JClassType string = typeOracle.findType(String.class.getName());
    assert string != null;
    JClassType resourcePrototype = typeOracle.findType(ResourcePrototype.class.getName());
    assert resourcePrototype != null;
    JParameterizedType mapStringRes = typeOracle.getParameterizedType(hashMap,
        new JClassType[]{string, resourcePrototype});
    return mapStringRes;
  }
View Full Code Here

   *
   * @param type the type in question
   * @return the suffix of the method to call
   */
  private static String getCallSuffix(JType type) {
    JParameterizedType isParameterized = type.isParameterized();
    if (isParameterized != null) {
      return getCallSuffix(isParameterized.getRawType());
    } else if (type.isPrimitive() != null) {
      if (type == JPrimitiveType.BOOLEAN) {
        return "Boolean";
      } else if (type == JPrimitiveType.BYTE) {
        return "Byte";
View Full Code Here

  }

  private JClassType tryEnhancingTypeInfo(String objectName, JClassType objectType) {
    OwnerField uiField = ownerClass.getUiField(objectName);
    if (uiField != null) {
      JParameterizedType pType = uiField.getRawType().isParameterized();
      if (pType != null) {
        // Even field is parameterized, it might be a super class. In that case, if we use the field
        // type then we might miss some add handlers methods from the objectType itself; something
        // we don't want to happen!
        if (pType.getBaseType().equals(objectType)) {
          // Now we proved type from UiField is more specific, let's use that one
          return pType;
        }
      }
    }
View Full Code Here

          "The method 'getAssociatedType()' in the event '%s' returns void.",
          eventType.getName());
      return null;
    }

    JParameterizedType isParameterized = returnType.isParameterized();
    if (isParameterized == null) {
      logger.warn(
          "The method 'getAssociatedType()' in '%s' does not return Type<? extends EventHandler>.",
          eventType.getName());
      return null;
    }

    JClassType[] argTypes = isParameterized.getTypeArgs();
    if ((argTypes.length != 1)
        && !argTypes[0].isAssignableTo(eventHandlerJClass)) {
      logger.warn(
          "The method 'getAssociatedType()' in '%s' does not return Type<? extends EventHandler>.",
          eventType.getName());
View Full Code Here

      } else {
        return "[" + getRpcTypeName(arrayType.getComponentType());
      }
    }

    JParameterizedType parameterizedType = type.isParameterized();
    if (parameterizedType != null) {
      return getRpcTypeName(parameterizedType.getBaseType());
    }

    JClassType classType = type.isClassOrInterface();
    assert (classType != null);
View Full Code Here

    return false;
  }

  private static void generateSerializationSignature(GeneratorContext context, JType type, CRC32 crc)
      throws UnsupportedEncodingException {
    JParameterizedType parameterizedType = type.isParameterized();
    if (parameterizedType != null) {
      generateSerializationSignature(context, parameterizedType.getRawType(), crc);

      return;
    }

    String serializedTypeName = getRpcTypeName(type);
View Full Code Here

   * <pre>
   *   &lt;span ui:field='el' /&gt;
   * </pre>
   */
  public void testLazyDomElementIncompatibleParameter() throws Exception {
    JParameterizedType parameterClass = mock(JParameterizedType.class);
    when(ownerFieldType.isParameterized()).thenReturn(parameterClass);

    JClassType arg = mock(JClassType.class);
    when(parameterClass.getTypeArgs()).thenReturn(new JClassType[] { arg });

    when(templateFieldType.isAssignableTo(arg)).thenReturn(false);
    when(parameterClass.getQualifiedSourceName()).thenReturn(QUALIFIED_SOURCE_NAME);

    try {
      new FieldWriterOfLazyDomElement(null,
          templateFieldType, ownerField, MortalLogger.NULL);
      fail("Expected exception not thrown.");
View Full Code Here

TOP

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

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.