public final class Types
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.reflect.GenericArrayType |
arrayOf(java.lang.reflect.Type componentType)
Returns an array type whose elements are all instances of
componentType. |
static java.lang.reflect.Type |
collectionElementType(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType)
Returns the element type of this collection type.
|
static java.lang.Class<?> |
getRawType(java.lang.reflect.Type type) |
static java.lang.reflect.ParameterizedType |
newParameterizedType(java.lang.reflect.Type rawType,
java.lang.reflect.Type... typeArguments)
Returns a new parameterized type, applying
typeArguments to rawType. |
static java.lang.reflect.WildcardType |
subtypeOf(java.lang.reflect.Type bound)
Returns a type that represents an unknown type that extends
bound. |
static java.lang.reflect.WildcardType |
supertypeOf(java.lang.reflect.Type bound)
Returns a type that represents an unknown supertype of
bound. |
public static java.lang.reflect.ParameterizedType newParameterizedType(java.lang.reflect.Type rawType,
java.lang.reflect.Type... typeArguments)
typeArguments to rawType.public static java.lang.reflect.GenericArrayType arrayOf(java.lang.reflect.Type componentType)
componentType.public static java.lang.reflect.WildcardType subtypeOf(java.lang.reflect.Type bound)
bound. For example, if
bound is CharSequence.class, this returns ? extends CharSequence. If
bound is Object.class, this returns ?, which is shorthand for ? extends Object.public static java.lang.reflect.WildcardType supertypeOf(java.lang.reflect.Type bound)
bound. For example, if bound is String.class, this returns ? super String.public static java.lang.Class<?> getRawType(java.lang.reflect.Type type)
public static java.lang.reflect.Type collectionElementType(java.lang.reflect.Type context,
java.lang.Class<?> contextRawType)
java.lang.IllegalArgumentException - if this type is not a collection.