/** * Returns a flag whether this configuration should always be created * and added to the resulting combined configuration. This flag is * evaluated only for optional configurations whose normal creation has * caused an error. If for such a configuration the * {@code forceCreate} attribute is set and the corresponding * configuration provider supports this mode, an empty configuration * will be created and added to the resulting combined configuration. * * @return the value of the {@code forceCreate} attribute * @since 1.4 */ public boolean isForceCreate() { return this.getConfiguration().getBoolean(ATTR_FORCECREATE, false); }
/** * Returns a flag whether this is an optional configuration. * * @return a flag if this declaration points to an optional * configuration */ public boolean isOptional() { Boolean value = this.getConfiguration().getBoolean(ATTR_OPTIONAL_RES, null); if (value == null) { value = this.getConfiguration().getBoolean(ATTR_OPTIONAL, Boolean.FALSE); } return value.booleanValue(); }
/** * Returns a flag whether this configuration should always be created * and added to the resulting combined configuration. This flag is * evaluated only for optional configurations whose normal creation has * caused an error. If for such a configuration the * {@code forceCreate} attribute is set and the corresponding * configuration provider supports this mode, an empty configuration * will be created and added to the resulting combined configuration. * * @return the value of the {@code forceCreate} attribute * @since 1.4 */ public boolean isForceCreate() { return this.getConfiguration().getBoolean(ATTR_FORCECREATE, false); }
/** * Returns a flag whether this is an optional configuration. * * @return a flag if this declaration points to an optional * configuration */ public boolean isOptional() { Boolean value = this.getConfiguration().getBoolean(ATTR_OPTIONAL_RES, null); if (value == null) { value = this.getConfiguration().getBoolean(ATTR_OPTIONAL, Boolean.FALSE); } return value.booleanValue(); }
public ConfigKey generateByPropertiesKey(String key) { SubnodeConfiguration configurationAt = null; try { if (Character.isLetter(key.charAt(0))) { configurationAt = keysConfig.configurationAt(key); } } catch (IllegalArgumentException e) { // Can't find a key. maybe its an alternate key. } if (configurationAt == null || configurationAt.isEmpty()) { key = alternateKeysMap.get(key); configurationAt = keysConfig.configurationAt(key); } String type = configurationAt.getString("type"); if (StringUtils.isBlank(type)) { type = "String"; } String[] validValues = configurationAt.getStringArray("validValues"); // Description containing the list delimiter *will* be broken into an array, so rejoin it using that delimiter. // We pad the separator because the strings in the array are trimmed automatically. String description = StringUtils.join(configurationAt.getStringArray("description"), configurationAt.getListDelimiter() + " "); String alternateKey = keysConfig.getString("/" + key + "/" + "alternateKey"); // If the isReloadable attribute isn't specified - assume it is false boolean reloadable = configurationAt.getBoolean("isReloadable", false); ConfigKey configKey = new ConfigKey(type, description, alternateKey, key, "", validValues, "", getHelperByType(type), reloadable, isDeprecated(key)); configKey.setParser(parser); return configKey; }