code: public static Integer getIntegerSetting(Map<String, Object> settings, String key, Integer defaultVal) {
  		final Object value = settings.get(key);
  		if (value == null) {
  			return defaultVal;
  		}
  
  		if (value instanceof Number) {
  			return ((Number) value).intValue();
  		}
  		if (value instanceof String) {
  			try {
  				return Integer.parseInt((String) value);
  			} catch (NumberFormatException e) {
  				return defaultVal;
  			}
  		}
  		return defaultVal;
  	}
docs: Gets an Integer value for the key, returning the default value given if
  not specified or not a valid numeric value.
  
  
  @param settings
  @param key        the key to get the Integer setting for
  @param defaultVal the default value to return if the setting was not specified
  or was not coercible to an Integer value
  @return the Integer value for the setting