code: protected int safeIntFromProperty(StringProperty strProp, String field, List<FieldError> errorsBuilder,
                                        int min, int max)  {
          String s = strProp.get();
          if (StringHelper.isStringEmptyOrNull(s)) {
              return 0;
          }
  
          int val = 0;
          try {
              val = Integer.valueOf(s);
              if(val < min || val > max) {
                  errorsBuilder.add(new FieldError("Value must be between " + min + " and " + max, field));
              }
          } catch (NumberFormatException e) {
              errorsBuilder.add(new FieldError("Value must be a number", field));
          }
          return val;
      }
docs: Gets the integer value from a text field property and validates it again the conditions provided. It must be
  a number and within the ranges provided.
  @param strProp the property to convert
  @param field the field to report errors against
  @param errorsBuilder the list of errors recorded so far
  @param min the minimum value allowed
  @param max the maximum value allowed
  @return the integer value if all conditions are met