public final class TypeHelper extends Object
Modifier and Type | Method and Description |
---|---|
static Type |
extractConstraintType(Class<? extends ConstraintValidator<?,?>> validator) |
static Type |
extractConstraintValidatorTypeArgumentType(Class<? extends ConstraintValidator<?,?>> validator,
int typeArgumentIndex) |
static Type |
extractValidatedType(Class<? extends ConstraintValidator<?,?>> validator) |
static GenericArrayType |
genericArrayType(Type componentType)
Creates a generic array type for the specified component type.
|
static Type |
getComponentType(Type type) |
static Class<?> |
getErasedReferenceType(Type type) |
static Type |
getErasedType(Type type)
Gets the erased type of the specified type.
|
static <A extends Annotation> |
getValidatorTypes(Class<A> annotationType,
List<ConstraintValidatorDescriptor<A>> validators) |
static boolean |
isArray(Type type) |
static boolean |
isAssignable(Type supertype,
Type type) |
static boolean |
isInstance(Type type,
Object object) |
static boolean |
isUnboundWildcard(Type type) |
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,ConstraintValidatorDescriptor<A>> getValidatorTypes(Class<A> annotationType, List<ConstraintValidatorDescriptor<A>> validators)
A
- the type of the annotationannotationType
- The annotation type.validators
- List of constraint validator classes (for a given constraint).public static Type extractValidatedType(Class<? extends ConstraintValidator<?,?>> validator)
public static Type extractConstraintType(Class<? extends ConstraintValidator<?,?>> validator)
public static Type extractConstraintValidatorTypeArgumentType(Class<? extends ConstraintValidator<?,?>> validator, int typeArgumentIndex)
public static boolean isUnboundWildcard(Type type)
Copyright © 2018 JBoss by Red Hat. All rights reserved.