public void validate(Messages errors, Object value, String propertyName, String modelName)
      throws Exception {

    if (value == null || value.toString().length() == 0) return;

    // Check if input is a number
    try {
      phoneNumber = new Long(value.toString());
    } catch (NumberFormatException ex) {
      errors.add("phone_valid_number_error", propertyName);
      return;
    }

    // Check if input length is at least greater than specified minimum length
    if (phoneNumber.toString().length() < minSize) {
      errors.add("phone_minimum_size_error", propertyName, "digits", new Long(minSize));
      return;
    }
  }
  public void validate(Messages errors, Object value, String propertyName, String modelName)
      throws Exception {

    String numberRegExp = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
    String ipRegExp =
        "\\b"
            + numberRegExp
            + "\\."
            + numberRegExp
            + "\\."
            + numberRegExp
            + "\\."
            + numberRegExp
            + "\\b";

    if (value == null || value.toString().length() == 0) return;

    if (!GenericValidator.matchRegexp(value.toString(), ipRegExp)) {
      errors.add("invalid_ip_error", propertyName);
    }
  }
 public void validate(Messages errors) throws Exception {
   if (Is.emptyString(getDescription())) {
     errors.add("blank_description");
   }
 }