JSR 303 Validation, If one field equals “something”, then these other fields should not be null

Define method that must validate to true and put the @AssertTrue annotation on the top of it:

  @AssertTrue
  private boolean isOk() {
    return someField != something || otherField != null;
  }

The method must start with ‘is’.

Leave a Comment