Let’s say I have the following classes :
public class MyProductCode {
private String code;
// getter and setter
}
public class MyProduct {
@NotNull
private MyProductCode myCode;
// getter and setter
}
Is it possible to validate the “code” property via the “MyProduct” class ?
Something like this :
@NotNull(property = "code")
private MyProductCode myCode;
Using Oval framework, it would be possible:
Refer Declaring constraints for nested properties