/** * Learn, recursively, whether any of the type parameters associated with {@code type} are bound to variables. * * @param type the type to check for type variables * @return boolean */ public static boolean containsTypeVariables(final Type type) { if (type instanceof TypeVariable<?>) { return true; } if (type instanceof Class<?>) { return ((Class<?>) type).getTypeParameters().length > 0; } if (type instanceof ParameterizedType) { for (final Type arg : ((ParameterizedType) type).getActualTypeArguments()) { if (containsTypeVariables(arg)) { return true; } } return false; } if (type instanceof WildcardType) { final WildcardType wild = (WildcardType) type; return containsTypeVariables(TypeUtils.getImplicitLowerBounds(wild)[0]) || containsTypeVariables(TypeUtils.getImplicitUpperBounds(wild)[0]); } return false; }
/** * Learn, recursively, whether any of the type parameters associated with {@code type} are bound to variables. * * @param type the type to check for type variables * @return boolean */ public static boolean containsTypeVariables(final Type type) { if (type instanceof TypeVariable<?>) { return true; } if (type instanceof Class<?>) { return ((Class<?>) type).getTypeParameters().length > 0; } if (type instanceof ParameterizedType) { for (final Type arg : ((ParameterizedType) type).getActualTypeArguments()) { if (containsTypeVariables(arg)) { return true; } } return false; } if (type instanceof WildcardType) { final WildcardType wild = (WildcardType) type; return containsTypeVariables(TypeUtils.getImplicitLowerBounds(wild)[0]) || containsTypeVariables(TypeUtils.getImplicitUpperBounds(wild)[0]); } return false; }
/** * Learn, recursively, whether any of the type parameters associated with {@code type} are bound to variables. * * @param type the type to check for type variables * @return boolean */ public static boolean containsTypeVariables(final Type type) { if (type instanceof TypeVariable<?>) { return true; } if (type instanceof Class<?>) { return ((Class<?>) type).getTypeParameters().length > 0; } if (type instanceof ParameterizedType) { for (final Type arg : ((ParameterizedType) type).getActualTypeArguments()) { if (containsTypeVariables(arg)) { return true; } } return false; } if (type instanceof WildcardType) { final WildcardType wild = (WildcardType) type; return containsTypeVariables(TypeUtils.getImplicitLowerBounds(wild)[0]) || containsTypeVariables(TypeUtils.getImplicitUpperBounds(wild)[0]); } return false; }
@Override public final Type getGenericType() { if (TypeUtils.containsTypeVariables(genericType)) { final Map<TypeVariable<?>, Type> args = TypeUtils.getTypeArguments(parent.getGenericType(), Object.class); return TypeUtils.unrollVariables(args, genericType); } return genericType; }
@Override public final Type getGenericType() { if (TypeUtils.containsTypeVariables(genericType)) { final Map<TypeVariable<?>, Type> args = TypeUtils.getTypeArguments(parent.getGenericType(), Object.class); return TypeUtils.unrollVariables(args, genericType); } return genericType; }
typeArguments = Collections.<TypeVariable<?>, Type> emptyMap(); if (containsTypeVariables(type)) { if (type instanceof TypeVariable<?>) { return unrollVariables(typeArguments, typeArguments.get(type));
typeArguments = Collections.<TypeVariable<?>, Type> emptyMap(); if (containsTypeVariables(type)) { if (type instanceof TypeVariable<?>) { return unrollVariables(typeArguments, typeArguments.get(type));
typeArguments = Collections.<TypeVariable<?>, Type> emptyMap(); if (containsTypeVariables(type)) { if (type instanceof TypeVariable<?>) { return unrollVariables(typeArguments, typeArguments.get(type));