org.apache.bval.jsr303.util
Class TypeUtils
java.lang.Object
org.apache.bval.jsr303.util.TypeUtils
public class TypeUtils
- extends Object
Description: Helper methods to determine the type for a ConstraintValidator class.
Alternative: could also do this by using
<groupId>com.googlecode.jtype</groupId>
<artifactId>jtype</artifactId>
<version>0.1.1</version>
but tried to reduce dependencies, so here is some code, that
handles java5 generic types to find suitable implementations for
ConstraintValidators.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TypeUtils
public TypeUtils()
getValidatorsTypes
public static <A extends Annotation> Map<Type,Class<? extends ConstraintValidator<A,?>>> getValidatorsTypes(Class<? extends ConstraintValidator<A,?>>[] validators)
- Given a set of
ConstraintValidator implementation classes, map those
to their target types.
- Parameters:
validators -
- Returns:
Map of Type : ConstraintValidator subtype
isAssignable
public static boolean isAssignable(Type supertype,
Type type)
- Learn whether
type is assignable to supertype.
- Parameters:
supertype - type -
- Returns:
- boolean
Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.