/** * Substitute the raw type if the supplied type is generic. * * @param type * @return original type or its raw type if it is generic */ private static JType possiblySubstituteRawType(JType type) { if (type != null) { JGenericType genericType = (JGenericType) type.isGenericType(); if (genericType != null) { type = genericType.getRawType(); } } return type; }
@Override public MetaTypeVariable[] getTypeParameters() { final JGenericType genericType; if (getEnclosedMetaObject().isGenericType() != null) { genericType = getEnclosedMetaObject().isGenericType(); } else if (getEnclosedMetaObject().isParameterized() != null) { genericType = getEnclosedMetaObject().isParameterized().getBaseType(); } else if (getEnclosedMetaObject().isRawType() != null) { genericType = getEnclosedMetaObject().isRawType().getGenericType(); } else { return new MetaTypeVariable[0]; } return Arrays.stream(genericType.getTypeParameters()) .map(p -> new GWTTypeVariable(oracle, p)).toArray(s -> new MetaTypeVariable[s]); }
@Override public MetaTypeVariable[] getTypeParameters() { final JGenericType genericType; if (getEnclosedMetaObject().isGenericType() != null) { genericType = getEnclosedMetaObject().isGenericType(); } else if (getEnclosedMetaObject().isParameterized() != null) { genericType = getEnclosedMetaObject().isParameterized().getBaseType(); } else if (getEnclosedMetaObject().isRawType() != null) { genericType = getEnclosedMetaObject().isRawType().getGenericType(); } else { return new MetaTypeVariable[0]; } return Arrays.stream(genericType.getTypeParameters()) .map(p -> new GWTTypeVariable(oracle, p)).toArray(s -> new MetaTypeVariable[s]); }
/** * @param boxed true if the primitive should be boxed. Useful when use in a parameterized type. * @param type type to convert * * @return the raw {@link TypeName} without parameter */ public TypeName rawName( boolean boxed, JType type ) { if ( null != type.isPrimitive() ) { return primitiveName( type.isPrimitive(), boxed ); } else if ( null != type.isParameterized() ) { return className( type.isParameterized().getRawType() ); } else if ( null != type.isGenericType() ) { return className( type.isGenericType().getRawType() ); } else if ( null != type.isArray() ) { return arrayName( type.isArray() ); } else if ( null != type.isTypeParameter() ) { return typeVariableName( type.isTypeParameter() ); } else { return className( type.isClassOrInterface() ); } }
/** * @param boxed true if the primitive should be boxed. Useful when use in a parameterized type. * @param type the type * * @return the {@link TypeName} */ public TypeName typeName( boolean boxed, JType type ) { if ( null != type.isPrimitive() ) { return primitiveName( type.isPrimitive(), boxed ); } else if ( null != type.isParameterized() ) { return parameterizedName( type.isParameterized() ); } else if ( null != type.isGenericType() ) { return genericName( type.isGenericType() ); } else if ( null != type.isArray() ) { return arrayName( type.isArray() ); } else if ( null != type.isTypeParameter() ) { return typeVariableName( type.isTypeParameter() ); } else if ( null != type.isWildcard() ) { return wildcardName( type.isWildcard() ); } else { return className( type.isClassOrInterface() ); } }
if ( null != mappedType.isGenericType() && (!isSerializers || !typeOracle.isEnumSupertype( mappedType )) ) { nbParam = mappedType.isGenericType().getTypeParameters().length;
if ( null != mappedType.isGenericType() && (!isSerializers || !typeOracle.isEnumSupertype( mappedType )) ) { nbParam = mappedType.isGenericType().getTypeParameters().length;
if ( configuredDeserializer.isPresent() ) { if ( null != type.isParameterized() || null != type.isGenericType() ) { JClassType[] typeArgs; if ( null != type.isGenericType() ) { typeArgs = type.isGenericType().asParameterizedByWildcards().getTypeArgs(); } else { typeArgs = type.isParameterized().getTypeArgs();
JGenericType typeGeneric = type.isGenericType(); if (typeGeneric != null) { endVisit(typeGeneric);
JGenericType typeGeneric = type.isGenericType(); if (typeGeneric != null) { endVisit(typeGeneric);
if ( keySerializer.isPresent() ) { if ( null != type.isParameterized() || null != type.isGenericType() ) { JClassType[] typeArgs; if ( null != type.isGenericType() ) { typeArgs = type.isGenericType().asParameterizedByWildcards().getTypeArgs(); } else { typeArgs = type.isParameterized().getTypeArgs();
if ( keyDeserializer.isPresent() ) { if ( null != type.isParameterized() || null != type.isGenericType() ) { JClassType[] typeArgs; if ( null != type.isGenericType() ) { typeArgs = type.isGenericType().asParameterizedByWildcards().getTypeArgs(); } else { typeArgs = type.isParameterized().getTypeArgs();
if ( configuredSerializer.isPresent() ) { if ( null != type.isParameterized() || null != type.isGenericType() ) { JClassType[] typeArgs; if ( null != type.isGenericType() ) { typeArgs = type.isGenericType().asParameterizedByWildcards().getTypeArgs(); } else { typeArgs = type.isParameterized().getTypeArgs();