my custom class is implemented via:
@RequiredIfSet.List({
@RequiredIfSet(field = "isFillingOutForSomeoneElse", dependentField = "reporterName", message = "may not be null"),
})
When I loop through my ConstraintViolations and whip it to the frontend via a DTO and ajax, I have getMessage() and getPropertyPath() in a little String[].
Works fine for everything, but propertyPath isn't set by this, as its not ON the field, its a list, how can i set it, or grab the field name to send back? Has been driving me crazy, have tried a few work around, also for note, heres where I loop:
public static <T> EntityValidationDTO GetEntityValidationDTO(Set<ConstraintViolation<T>> cv){
List<String[]> invalidFields = new ArrayList<String[]>();
Iterator<ConstraintViolation<T>> iterator = cv.iterator();
while(iterator.hasNext()) {
ConstraintViolation<T> i = iterator.next();
String message = i.getMessage();
String property = i.getPropertyPath().toString();
invalidFields.add(new String[] { property, message });
}
EntityValidationDTO EVDTO = new EntityValidationDTO();
EVDTO.setStatus("fail");
EVDTO.setInvalidFields(invalidFields);
return EVDTO;
}