Object value = null;
try {
value = field.get(request);
} catch (Exception e) {
// not cool...
throw new ValidationConstraintViolationException(e);
}
if (value == null || value instanceof String && ((String) value).isEmpty()) {
ConstraintViolation violation = ConstraintViolation.newConstraintViolation("@" + Required.class.getSimpleName(), field);
leafs.add(violation);
}
}
}
if (!leafs.isEmpty()) {
throw new ValidationConstraintViolationException(preMessage, leafs);
}
}
}