@Override public MetaType[] getTypeParameters() { final List<MetaType> types = new ArrayList<MetaType>(); for (final JClassType parm : parameterizedType.getTypeArgs()) { if (parm.isWildcard() != null) { types.add(new GWTWildcardType(oracle, parm.isWildcard())); } else if (parm.isTypeParameter() != null) { types.add(new GWTTypeVariable(oracle, parm.isTypeParameter())); } else if (parm.isClassOrInterface() != null || parm.isEnum() != null || parm.isPrimitive() != null || parm.isRawType() != null || parm.isArray() != null || parm.isAnnotation() != null) { types.add(GWTClass.newInstance(oracle, parm)); } else { throw new IllegalArgumentException( "Unsupported kind of type parameter " + parm + " in type " + parameterizedType.getName()); } } return types.toArray(new MetaType[types.size()]); }
public JParameterizedType asParameterizationOf(JGenericType type) { Set<JClassType> supertypes = getFlattenedSuperTypeHierarchy(this); for (JClassType supertype : supertypes) { JParameterizedType isParameterized = supertype.isParameterized(); if (isParameterized != null && isParameterized.getBaseType() == type) { return isParameterized; } JRawType isRaw = supertype.isRawType(); if (isRaw != null && isRaw.getBaseType() == type) { return isRaw.asParameterizedByWildcards(); } } return null; }