|
OK, back at work. I still think the above code looks suspicious, but that is not my issue. If I name a method wrongly, it's simply not validated. If, however, it's private, validation produces NullPointerException. It does not work with every method, but the example below produces one. Examle method:
public class Project
{
[...]
@NotNull
@UnwrapValidatedValue
public Optional<LocalDate> getStart()
{
return Optional.ofNullable(this.start);
}
@NotNull
@UnwrapValidatedValue
public Optional<LocalDate> getEnd()
{
return Optional.ofNullable(this.end);
}
@AssertTrue
private Boolean getStartBeforeEnd()
{
return this.getStart().orElse(LocalDate.MAX).isBefore(this.getEnd().orElse(LocalDate.MIN));
}
}
I'm having trouble setting up my environment to compile HV, hope this example helps.
|