假设我有以下课程:
public class MyProductCode {
private String code;
// getter and setter
}
public class MyProduct {
@NotNull
private MyProductCode myCode;
// getter and setter
}
是否可以通过“MyProduct”类验证“code”属性? 像这样:
@NotNull(property = "code")
private MyProductCode myCode;