public final class TypeHelper extends Object
Modifier and Type | Method and Description |
---|---|
static GenericArrayType |
genericArrayType(Type componentType)
Creates a generic array type for the specified component type.
|
static Type |
getComponentType(Type type) |
static Type |
getErasedType(Type type)
Gets the erased type of the specified type.
|
static <A extends Annotation> |
getValidatorsTypes(Class<A> annotationType,
List<Class<? extends ConstraintValidator<A,?>>> validators) |
static boolean |
isArray(Type type) |
static boolean |
isAssignable(Type supertype,
Type type) |
static boolean |
isInstance(Type type,
Object object) |
static ParameterizedType |
parameterizedType(Class<?> rawType,
Type... actualTypeArguments)
Creates a parameterized type for the specified raw type and actual type arguments.
|
public static Type getErasedType(Type type)
type
- the type to perform erasure onpublic static boolean isArray(Type type)
public static GenericArrayType genericArrayType(Type componentType)
componentType
- the component typepublic static ParameterizedType parameterizedType(Class<?> rawType, Type... actualTypeArguments)
rawType
- the raw typeactualTypeArguments
- the actual type argumentsMalformedParameterizedTypeException
- if the number of actual type arguments differs from those defined on the raw typepublic static <A extends Annotation> Map<Type,Class<? extends ConstraintValidator<A,?>>> getValidatorsTypes(Class<A> annotationType, List<Class<? extends ConstraintValidator<A,?>>> validators)
validators
- List of constraint validator classes (for a given constraint).Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved