private static Class<?> resolveType(final Class<?> targetClass, final Type type) { if (type instanceof Class) return (Class<?>) type; if (!(type instanceof TypeVariable<?>)) { return null; } Type targetType = null; Map<TypeVariable<?>, Type> typeMap = getTypeMap(targetClass); for (Map.Entry<TypeVariable<?>, Type> typeVariableEntry : typeMap.entrySet()) { TypeVariable<?> typeVariable = typeVariableEntry.getKey(); if (typeVariable.getName().equals(((TypeVariable) type).getName())) { targetType = typeVariableEntry.getValue(); break; } } if (targetType instanceof Class) { return (Class<?>) targetType; } return null; }
private static Class<?> resolveType(final Class<?> targetClass, final Type type) { if (type instanceof Class) return (Class<?>) type; if (!(type instanceof TypeVariable<?>)) { return null; } Type targetType = null; Map<TypeVariable<?>, Type> typeMap = getTypeMap(targetClass); for (Map.Entry<TypeVariable<?>, Type> typeVariableEntry : typeMap.entrySet()) { TypeVariable<?> typeVariable = typeVariableEntry.getKey(); if (typeVariable.getName().equals(((TypeVariable) type).getName())) { targetType = typeVariableEntry.getValue(); break; } } if (targetType instanceof Class) { return (Class<?>) targetType; } return null; }