Example usage for org.springframework.core MethodParameter setParameterType

List of usage examples for org.springframework.core MethodParameter setParameterType

Introduction

In this page you can find the example usage for org.springframework.core MethodParameter setParameterType.

Prototype

@Deprecated
void setParameterType(@Nullable Class<?> parameterType) 

Source Link

Document

Set a resolved (generic) parameter type.

Usage

From source file:org.springframework.core.GenericTypeResolver.java

/**
 * Determine the target type for the given generic parameter type.
 * @param methodParam the method parameter specification
 * @param clazz the class to resolve type variables against
 * @return the corresponding generic parameter or return type
 *///from   w w w . ja  v a2 s .com
public static Class<?> resolveParameterType(MethodParameter methodParam, Class clazz) {
    Type genericType = getTargetType(methodParam);
    Assert.notNull(clazz, "Class must not be null");
    Map<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz);
    Type rawType = getRawType(genericType, typeVariableMap);
    Class result = (rawType instanceof Class ? (Class) rawType : methodParam.getParameterType());
    methodParam.setParameterType(result);
    methodParam.typeVariableMap = typeVariableMap;
    return result;
}