if (!ValidationResult.class.isAssignableFrom(publicMethod.getReturnType())) {
throw ValidateMessages.MESSAGES.invalidMethodSignatureMustReturnValidationResult(publicMethod.getName(),
publicMethod.getDeclaringClass().getName());
}
Validator validator = new BaseValidator(name) {
@Override
public ValidationResult validate(Object subject) {
try {
return ValidationResult.class.cast(publicMethod.invoke(validatorObject, subject));
} catch (InvocationTargetException e) {