/** * Get a configuration field value with a run-time default. * * @param persister The configuration source. * @param defaultValue The default value to use if a value is * not specified by the configuration source. * @return The field value. */ public String getProperty(ConfigPersister persister, String defaultValue) { try { String value = persister.getProperty(sourceType, getPropertyName()); return value != null ? value : defaultValue; } catch (NoSuchElementException ex) { // primitives //noinspection StringEquality if (defaultValue == ConfigUtil.NO_DEFAULT) { throw ex; } return defaultValue; } }