public static Class < ? > resolveReturnType ( Method method , Class < ? > clazz ) { Assert . notNull ( method , "Method must not be null" ) ; Type genericType = method . getGenericReturnType ( ) ; Assert . notNull ( clazz , "Class must not be null" ) ; Map < TypeVariable , Type > typeVariableMap = getTypeVariableMap ( clazz ) ; Type rawType = getRawType ( genericType , typeVariableMap ) ; return ( rawType instanceof Class ? ( Class < ? > ) rawType : method . getReturnType ( ) ) ; }
Determine the target type for the generic return type of the given method where formal type variables are declared on the given class .