Get an optional string associated with a key. It returns the defaultValue
if there is no such key.

@param key
A key string.
@param defaultValue
The default.
@return A string which is the value.
965220
public String optString(String key, String defaultValue) {
        Object object = this.opt(key);
        return NULL.equals(object) ? defaultValue : object.toString();
    }
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());
    }
1008165
public static String toStringWithDefault(Object value, String defaultValue) {
		String result = toNullableString(value);
		return result != null ? result : defaultValue;
	}
1034312
public String getProperty(String key, String defaultValue) {
        String value = getProperty(key, String.class);
        return StringUtils.isEmpty(value) ? defaultValue : value;
    }
504777
public String getString(String nameOfField, String defaultValue) {
		String value = (String) stringData.get(nameOfField);
		
		if (value == null) {
			return defaultValue;
		}
		
		return value;
	}
1261881
public String getRequiredConfigAttributeWithDefaultValue(Map<String, Object> props, String key, String defaultValue) {
        return getRequiredConfigAttributeWithDefaultValueAndConfigId(props, key, defaultValue, null);
    }
1322401
public String optString(int index, String defaultValue) {
        Object object = this.opt(index);
        return JSONObject.NULL.equals(object) ? defaultValue : object
                .toString();
    }
328228
public String getProperty(String key, String defaultValue) {

		String property = configProperties.getProperty(key, defaultValue);
		if (property != null) {
			property = property.trim();
		}
		return property;
	}
7785
@Override
    public String getString( final String      key,
                             final String      defaultValue )
    {
        String  candidate;
        candidate = getFormattedPropValue( key );

        if ( candidate == null )
        {
            return defaultValue;
        }

        return candidate;
    }
1127263
public java.lang.String getBetaSettingsOrDefault(
      java.lang.String key,
      java.lang.String defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetBetaSettings().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
359950
public String getDefaultValue(String strKey)
    {
        if (DESCRIPTIONS == null)
            DESCRIPTIONS = Utility.arrayToMap(DEFAULTS);
        return (String)DESCRIPTIONS.get(strKey);
    }
218062
@Override
    public List<String> getStringList( final String             key,
                                       final List<String>       defaultValue )
    {
        return getStringList( key, DEFAULT_LIST_DELIMITER, defaultValue );
    }
411218
public String getSetting(final String key, final String defaultValue) {
        val result = environment.getProperty(this.propertyPrefix + '.' + key);
        return StringUtils.defaultIfBlank(result, defaultValue);
    }
889369
protected final <T> String getString(final IKey<T> key) {
        final Object value = config.get(key.key());

        return String.valueOf(value != null ? value : key.getDefaultValue());
    }
1118378
public java.lang.String getRetOrDefault(
      java.lang.String key,
      java.lang.String defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetRet().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
168541
public String getProperty(String key, String defaultValue) {
        String val = properties.get(key);

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

        return val;
    }
751089
public String[] getStringsWithDefault(String key, String[] defaultValue) {
		String[] value = getStrings(key, null);
		if (null == value) {
			value = defaultValue;
		}

		return value;
	}