Get a property as an int or default value.

@param key the property name
@param defaultValue the default value
545225
@Override
    public final Integer optInt(final String key, final Integer defaultValue) {
        Integer result = optInt(key);
        return result == null ? defaultValue : result;
    }
341795
public static Integer getInteger(String propertyName, String envName, Integer defaultValue) {
		checkEnvName(envName);
		Integer propertyValue = NumberUtil.toIntObject(System.getProperty(propertyName), null);
		if (propertyValue != null) {
			return propertyValue;
		} else {
			propertyValue = NumberUtil.toIntObject(System.getenv(envName), null);
			return propertyValue != null ? propertyValue : defaultValue;
		}
	}
377896
public Object get(String key, Object defaultValue) {
        Object value = get(key);
        return value == null ? defaultValue : value;
    }
521617
public String getProperty(String key, String defaultValue) {
        String value = resolver.get(key);
        return (value == null) ? defaultValue : value;
    }
445475
public static String getSystemProperty(String key, @Nullable String defaultValue) {
    String value;
    try {
      value = System.getProperty(key);
    } catch (AccessControlException ex) {
      return defaultValue;
    }
    return value != null ? value : defaultValue;
  }
995416
public String getCommonProperty(String key, String defaultValue) {
		return props.getProperty(PropertiesBundleConstant.PROPS_PREFIX + key, defaultValue);
	}
1256744
@Override
    public int getInt( final String    key,
                       final int       defaultValue )
    {
        return formatInt( key, getFormattedPropValue( key ), defaultValue );
    }
1207242
public int getIntProperty( String key , int defaultValue )
    {
        String value = SystemTools.replaceSystemProperties(settings.getProperty(key));
        if (value == null)
            return defaultValue;
        try
        {
            return Integer.parseInt(value);
        }
        catch (Exception e)
        {
            return defaultValue;
        }
    }
938624
public int getInteger( String key, int defaultValue )
        throws MissingResourceException
    {
        try
        {
            return getInteger( key );
        }
        catch( MissingResourceException mre )
        {
            return defaultValue;
        }
    }
304303
public static int getIntegerValue(String appName, String key, int defaultValue) {
        String ret = getStringValue0(appName, key);
        return StringUtils.isEmpty(ret) ? defaultValue : CommonUtils.parseInt(ret, defaultValue);
    }
1081630
public int getProperty(String propName, int defaultValue) {
        String propValue = props.getProperty(propName);
        return (propValue == null) ? defaultValue : Integer.parseInt(propValue);
    }
591538
public static <T> T getOrDefaultValue(String primaryKey, T defaultValue) {
        Object val = CFG.get(primaryKey);
        return val == null ? defaultValue : (T) CompatibleTypeUtils.convert(val, defaultValue.getClass());
    }
168541
public String getProperty(String key, String defaultValue) {
        String val = properties.get(key);

        if (val == null) {
            val = defaultValue;
        }

        return val;
    }
1247352
@SuppressWarnings("null")
	public static String value(String key, String defaultValue) {
		return System.getProperty(key, defaultValue);
	}
1071004
public static int toIntWithDefault(String value, int defaultValue) {

        int result = defaultValue;
        try {
            result = Integer.parseInt(value);
        } catch (@SuppressWarnings("unused") Exception e) {
            // Do nothing, return default.
        }
        return result;
    }
965214
public <T> T get(String key, T defaultValue) {
        T value = get(key);
        if (value == null) {
            return defaultValue;
        }
        return value;
    }
372342
private static int getProperty(String prefix, String name, int defaultValue) {
        int result = defaultValue;

        try {
            result = Integer.parseInt(System.getProperty(prefix + name));
        } catch (NumberFormatException e) {
            LOG.warn("Value for " + prefix + name + " must be an integer. Using default " + defaultValue);
        }
        return result;
    }