Returns a String-valued setting. Setting is first looked from the namespace that is set (if any) and then from the secondary namespace (if any). All other getters use this method as their first step too (so all getters may throw SettingsError and look from both namespaces). @param name Name of the s
(String name)
| 358 | * the namespaces |
| 359 | */ |
| 360 | public String getSetting(String name) { |
| 361 | String fullPropName; |
| 362 | if (props == null) { |
| 363 | init(null); |
| 364 | } |
| 365 | fullPropName = getFullPropertyName(name, false); |
| 366 | String value = props.getProperty(fullPropName); |
| 367 | |
| 368 | if (value != null) { // found value, check if run setting can be parsed |
| 369 | value = parseRunSetting(value.trim()); |
| 370 | } |
| 371 | |
| 372 | if ((value == null || value.length() == 0) && |
| 373 | this.secondaryNamespace != null) { |
| 374 | // try secondary namespace if the value wasn't found from primary |
| 375 | fullPropName = getFullPropertyName(name, true); |
| 376 | value = props.getProperty(fullPropName); |
| 377 | |
| 378 | if (value != null) { |
| 379 | value = parseRunSetting(value.trim()); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | if (value == null || value.length() == 0) { |
| 384 | throw new SettingsError("Can't find setting " + |
| 385 | getPropertyNamesString(name)); |
| 386 | } |
| 387 | |
| 388 | outputSetting(fullPropName + " = " + value); |
| 389 | return value; |
| 390 | } |
| 391 | |
| 392 | /** |
| 393 | * Returns the given setting if it exists, or defaultValue if the setting |