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

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


    @Override
    protected void generateClassBody() throws UnableToCompleteException {
      // Find the type to clone
      JClassType[] implementedInterfaces = baseType.getImplementedInterfaces();
      for(JClassType iface : implementedInterfaces) {
        JParameterizedType parameterizedType = iface.isParameterized();
        if(parameterizedType == null)
          continue;
        if(parameterizedType.getSimpleSourceName().equals("Cloner")) {
          JClassType[] typeArgs = parameterizedType.getTypeArgs();
          if(typeArgs.length != 1) {
            logger.log(TreeLogger.ERROR, "Cloner interface must be parameterized to the type of object to clone", null);
            throw new UnableToCompleteException();
          }
          beanTypes.add(typeArgs[0]);
View Full Code Here


        @Override
        protected void generateClassBody() throws UnableToCompleteException {
            // Find the interface to implement
            JClassType[] implementedInterfaces = baseType.getImplementedInterfaces();
            for(JClassType iface : implementedInterfaces) {
                JParameterizedType parameterizedType = iface.isParameterized();
                if(parameterizedType == null)
                    continue;
                if(iface.getErasedType().getQualifiedSourceName().equals(ServiceProfilingAdapter.class.getName())) {
                    JClassType[] typeArgs = parameterizedType.getTypeArgs();
                    if(typeArgs.length != 1) {
                        logger.log(TreeLogger.ERROR, "ServiceProfilingAdapter interface must be parameterized to the type of object to clone", null);
                        throw new UnableToCompleteException();
                    }
                    generateInterface(typeArgs[0]);
View Full Code Here

    assert returnTypeRef[0] != null;
    resolveGenerics();
    outerClass = (JClassType) returnTypeRef[0];
    JClassType searchClass = outerClass;
    try {
      JParameterizedType pt = searchClass.isParameterized();
      if (pt != null) {
        searchClass = pt.getBaseType();
      }
      returnTypeRef[0] = searchClass.getNestedType(innerName);
    } catch (NotFoundException e) {
      logger.log(TreeLogger.ERROR, "Unable to resolve inner class "
          + innerName + " in " + searchClass, e);
View Full Code Here

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

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

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

public class GWTClass extends AbstractMetaClass<JType> {
  private Annotation[] annotationsCache;

  private GWTClass(JType classType, boolean erased) {
    super(classType);
    JParameterizedType parameterizedType = classType.isParameterized();
    if (!erased && parameterizedType != null) {
      super.parameterizedType = new GWTParameterizedType(parameterizedType);
    }
  }
View Full Code Here

      try {
        if (returnType != null
            && returnType.isAssignableTo(oracle.getType(List.class
                .getName()))
            && returnType.isParameterized() != null) {
          JParameterizedType type = returnType.isParameterized();
          JClassType[] params = type.getTypeArgs();
          if (beans.contains(params[0])) {
            sw.println("if (value != null) {");
            sw.indent();
            sw.println("java.util.List list = (java.util.List)value;");
            sw.println("java.util.List list2 = "
View Full Code Here

                    + "must be declared as java.util.List or arrays in "
                    + m.getEnclosingType().getSimpleSourceName() + "."
                    + m.getName());
                throw new UnableToCompleteException();
              }
              JParameterizedType paramType = classType.isParameterized();
              if (paramType != null) {
                elemType = paramType.getTypeArgs()[0];
              } else {
                elemType = classType.getOracle().getJavaLangObject();
              }
            } else {
              JArrayType arrayType = listType.isArray();
View Full Code Here

        if (!SerializableTypeOracleBuilder.shouldConsiderFieldsForSerialization(subtype,
            typeFilter, new ProblemReport())) {
          continue;
        }

        JParameterizedType asParameterizationOf = subtype.asParameterizationOf(baseType);
        Set<JTypeParameter> paramsUsed = new LinkedHashSet<JTypeParameter>();
        SerializableTypeOracleBuilder.recordTypeParametersIn(
            asParameterizationOf.getTypeArgs()[ordinal], paramsUsed);

        for (JTypeParameter paramUsed : paramsUsed) {
          recordCausesExposure(isGeneric, paramUsed.getOrdinal(), 0);
        }
      }

      JClassType type = baseType;
      while (type != null) {
        if (SerializableTypeOracleBuilder.shouldConsiderFieldsForSerialization(type, typeFilter,
            new ProblemReport())) {
          JField[] fields = type.getFields();
          for (JField field : fields) {
            if (!SerializableTypeOracleBuilder.shouldConsiderForSerialization(TreeLogger.NULL,
                context, field)) {
              continue;
            }

            JParameterizedType isParameterized = field.getType().getLeafType().isParameterized();
            if (isParameterized == null) {
              continue;
            }

            JClassType[] typeArgs = isParameterized.getTypeArgs();
            for (int i = 0; i < typeArgs.length; ++i) {
              if (referencesTypeParameter(typeArgs[i], getTypeParameter())) {
                JGenericType genericFieldType = isParameterized.getBaseType();
                recordCausesExposure(genericFieldType, i, 0);
                JArrayType typeArgIsArray = typeArgs[i].isArray();
                if (typeArgIsArray != null && typeArgIsArray.getLeafType() == getTypeParameter()) {
                  int dims = typeArgIsArray.getRank();
                  recordCausesExposure(genericFieldType, i, dims);
View Full Code Here

      for (JClassType bound : isWildcard.getUpperBounds()) {
        recordTypeParametersIn(bound, params);
      }
    }

    JParameterizedType isParameterized = type.isParameterized();
    if (isParameterized != null) {
      for (JClassType arg : isParameterized.getTypeArgs()) {
        recordTypeParametersIn(arg, params);
      }
    }
  }
View Full Code Here

    if (classOrInterface.isEnum() != null) {
      // The fields of an enum are never serialized; they are always okay.
      return true;
    }

    JParameterizedType isParameterized = classOrInterface.isParameterized();
    if (isParameterized != null) {
      if (isRawMapOrRawCollection(classOrInterface)) {
        /*
         * Backwards compatibility. Raw collections or maps force all object
         * subtypes to be considered.
         */
        checkAllSubtypesOfObject(logger, parent, problems);
      } else {
        TreeLogger paramsLogger =
            logger.branch(TreeLogger.DEBUG, "Checking parameters of '"
                + isParameterized.getParameterizedQualifiedSourceName() + "'");

        for (JTypeParameter param : isParameterized.getBaseType().getTypeParameters()) {
          if (!checkTypeArgument(paramsLogger, isParameterized.getBaseType(), param.getOrdinal(),
              isParameterized.getTypeArgs()[param.getOrdinal()], parent, problems)) {
            return false;
          }
        }
      }
    }
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.