public static Type resolve(Class<?> concreteClass, Type type) { if (type instanceof TypeVariable<?>) { return resolveTypeVariableType(concreteClass, (TypeVariable<?>) type); } else if (type instanceof GenericArrayType) { return getArrayClass((GenericArrayType) type); } else if (type instanceof WildcardType) { WildcardType wildcardType = ((WildcardType) type); if (wildcardType.getLowerBounds().length > 0) { return resolve(concreteClass, wildcardType.getLowerBounds()[0]); } else { return resolve(concreteClass, wildcardType.getUpperBounds()[0]); } } else { // We assume here that only class types, type variables and parameterized types are // possible as argument types for the parameterized type return type; } }
Type parameterType = ReflectionUtils.resolve(entityViewClass, constructor.getGenericParameterTypes()[index]); Class<?> type = ReflectionUtils.resolveType(entityViewClass, parameterType); boolean forceSingular = parameterAnnotations.containsKey(MappingSingular.class) || parameterAnnotations.containsKey(MappingParameter.class);
return resolve(concreteClass, typeVariable.getBounds()[0]);
public MethodAttributeMapping readMethodAttributeMapping(ViewMapping viewMapping, Annotation mapping, String attributeName, Method method) { Class<?> entityViewClass = viewMapping.getEntityViewClass(); Type returnType = ReflectionUtils.resolve(entityViewClass, method.getGenericReturnType()); Class<?> type = ReflectionUtils.resolveType(entityViewClass, returnType); boolean forceSingular = AnnotationUtils.findAnnotation(method, MappingSingular.class) != null || AnnotationUtils.findAnnotation(method, MappingParameter.class) != null;