for (Class<? extends ConstraintValidator<A, ?>> validatorType : constraintValidatorClasses) {
Type validatedType =
TypeUtils.getTypeArguments(validatorType, ConstraintValidator.class).get(
ConstraintValidator.class.getTypeParameters()[1]);
if (validatedType == null) {
throw new ValidationException(String.format("Could not detect validated type for %s", validatorType));
}
if (validatedType instanceof GenericArrayType) {
Type componentType = TypeUtils.getArrayComponentType(validatedType);
if (componentType instanceof Class<?>) {
validatedType = Array.newInstance((Class<?>) componentType, 0).getClass();