org.springframework.core
Class GenericTypeResolver

java.lang.Object
  extended by org.springframework.core.GenericTypeResolver

public abstract class GenericTypeResolver
extends Object

Helper class for resolving generic types against type variables.

Mainly intended for usage within the framework, resolving method parameter types even when they are declared generically.

Only usable on Java 5. Use an appropriate JdkVersion check before calling this class, if a fallback for JDK 1.4 is desirable.

Since:
2.5.2
Author:
Juergen Hoeller, Rob Harrop
See Also:
GenericCollectionTypeResolver, JdkVersion

Constructor Summary
GenericTypeResolver()
           
 
Method Summary
static Type getTargetType(MethodParameter methodParam)
          Determine the target type for the given parameter specification.
static Class resolveParameterType(MethodParameter methodParam, Class clazz)
          Determine the target type for the given generic parameter type.
static Class resolveReturnType(Method method, Class clazz)
          Determine the target type for the generic return type of the given method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericTypeResolver

public GenericTypeResolver()
Method Detail

getTargetType

public static Type getTargetType(MethodParameter methodParam)
Determine the target type for the given parameter specification.

Parameters:
methodParam - the method parameter specification
Returns:
the corresponding generic parameter type

resolveParameterType

public static Class resolveParameterType(MethodParameter methodParam,
                                         Class clazz)
Determine the target type for the given generic parameter type.

Parameters:
methodParam - the method parameter specification
clazz - the class to resolve type variables against
Returns:
the corresponding generic parameter or return type

resolveReturnType

public static Class resolveReturnType(Method method,
                                      Class clazz)
Determine the target type for the generic return type of the given method.

Parameters:
method - the method to introspect
clazz - the class to resolve type variables against
Returns:
the corresponding generic parameter or return type


Copyright © 2002-2008 The Spring Framework.