org.apache.tapestry5.ioc.internal.util
Class GenericsUtils
java.lang.Object
org.apache.tapestry5.ioc.internal.util.GenericsUtils
public class GenericsUtils
- extends java.lang.Object
Static methods related to the use of JDK 1.5 generics.
|
Method Summary |
static java.lang.Class |
asClass(java.lang.reflect.Type actualType)
|
static java.lang.reflect.Type |
extractActualType(java.lang.reflect.Type owner,
java.lang.reflect.Field field)
|
static java.lang.reflect.Type |
extractActualType(java.lang.reflect.Type owner,
java.lang.reflect.Method method)
|
static java.lang.Class |
extractGenericFieldType(java.lang.Class containingClassType,
java.lang.reflect.Field field)
Analyzes the field in the context of a particular concrete implementation of the class to establish
the generic type of a (public) field. |
static java.lang.Class |
extractGenericReturnType(java.lang.Class containingClassType,
java.lang.reflect.Method method)
Analyzes the method (often defined in a base class) in the context of a particular concrete implementation of the
class to establish the generic type of a property. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GenericsUtils
public GenericsUtils()
extractGenericReturnType
public static java.lang.Class extractGenericReturnType(java.lang.Class containingClassType,
java.lang.reflect.Method method)
- Analyzes the method (often defined in a base class) in the context of a particular concrete implementation of the
class to establish the generic type of a property. This works when the property type is defined as a class
generic parameter.
- Parameters:
containingClassType - class containing the method, used to reason about genericsmethod - method (possibly from a base class of type) to extract
- Returns:
- the generic type if it may be determined, or the raw type (that is, with type erasure, most often
Object)
extractGenericFieldType
public static java.lang.Class extractGenericFieldType(java.lang.Class containingClassType,
java.lang.reflect.Field field)
- Analyzes the field in the context of a particular concrete implementation of the class to establish
the generic type of a (public) field. This works when the field type is defined as a class
generic parameter.
- Parameters:
containingClassType - class containing the method, used to reason about genericsfield - public field to extract type from
- Returns:
- the generic type if it may be determined, or the raw type (that is, with type erasure, most often
- Since:
- 5.2.0
extractActualType
public static java.lang.reflect.Type extractActualType(java.lang.reflect.Type owner,
java.lang.reflect.Field field)
- Parameters:
owner - - type that owns the fieldfield - - field that is generic
- Returns:
- Type
extractActualType
public static java.lang.reflect.Type extractActualType(java.lang.reflect.Type owner,
java.lang.reflect.Method method)
- Parameters:
owner - - type that owns the fieldmethod - - method with generic return type
- Returns:
- Type
asClass
public static java.lang.Class asClass(java.lang.reflect.Type actualType)
Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.