protected static Integer parseInteger(final Object obj, final String type) throws ParseException {
    final Integer result;
    try {
      result = Integer.valueOf(obj.toString());
    } catch (NumberFormatException nfe) {
      throw new ParseException(obj + " is not a valid " + type + ".");
    }
    return result;
  }