1
@ValidateWithMethod(methodName = "isValidPostalCode", parameterType = String.class)
private String _postalCode;

private boolean isValidPostalCode(String _postalCode) {
   boolean status = false;
   if (this.getTypeEnum() == 2) {
       if ((this.getPostal_code() == null)|| (this.getPostal_code() == "")) {
           status = true;
       }
   }
   return status;
}

I'm developing an Android Application with the use of Oval 1.7 as well. I'm trying to validate an Entity class (property validation), with the use of @ValidateWithMethod, but it's not working, I guess its not recognizing the method, all other annotations like @MaxLength(value = 12) are working. Please help...

Rakhita
  • 4,493
  • 1
  • 16
  • 15

1 Answers1

1

Try with:

private boolean isValidPostalCode(String postalCode) {

if (postalCode == null || postalCode.isEmpty()) {

EDIT: You should also add ignoreIfNull = false to the annotation. see http://oval.sourceforge.net/api/net/sf/oval/constraint/ValidateWithMethod.html#ignoreIfNull()