I'm using OVAL as object validation framework in my project. Let's say I have the following object:
public class MyObject {
@NotNull(message = "Amount cannot be null.")
@NotNegative(when = "groovy:((_value != null) && (_value.getAmount() <= 0))", message = "Amount cannot be ZERO or negative.")
private Currency amount;
}
Without specifying (_value != null) in @NotNegative annotation it fails with java.lang.NullPointerException even though there is additional @NotNull annotation which should check that case.
Is it possible somehow to avoid that duplication?