public abstract class MyProperties
extends java.util.Properties
Modifier and Type | Class and Description |
---|---|
static class |
MyProperties.SKIPAUTOLOAD |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SUFFIX |
Constructor and Description |
---|
MyProperties() |
MyProperties(boolean resolveSystemPropertyReferences)
Creates the Properties object, and tries to load it from one of the following places:
A resource available to this' classloader
A file in the directory pointed to by the user.dir system property
A file in the directory pointed to by the user.home system property
|
MyProperties(MyProperties.SKIPAUTOLOAD skipAutoLoad)
Constructor that skips the automatic loading process.
|
MyProperties(java.util.Properties defaults)
Creates the MyProperties
|
MyProperties(java.util.Properties defaults,
boolean resolveSystemPropertyReferences)
Creates the MyProperties
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getOptionalProperty(java.util.Properties properties,
java.lang.String key)
Gets the named property value from the given Properties object.
|
java.lang.String |
getOptionalProperty(java.lang.String key)
Gets the named property value from the given Properties object.
|
static java.lang.String |
getPropertiesBaseName(java.lang.Class<? extends java.util.Properties> propertiesClass)
Gets the base name for the properties resource corresponding to the given class.
|
static java.lang.String |
getRequiredProperty(java.util.Properties properties,
java.lang.String key)
Gets the named property value from the given Properties object.
|
java.lang.String |
getRequiredProperty(java.lang.String key)
Gets the named property value from the given Properties object.
|
static java.lang.String |
resolveSystemPropertyRefs(java.lang.String propertyValue)
Resolves any references to System Properties in a String value by replacing the reference with the actual System Property value.
|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values
public static final java.lang.String SUFFIX
public MyProperties()
public MyProperties(boolean resolveSystemPropertyReferences)
resolveSystemPropertyReferences
- flag to indicate whether System property references (e.g.${user.home}) are to be resolved when loading the propertiespublic MyProperties(java.util.Properties defaults)
defaults
- -public MyProperties(java.util.Properties defaults, boolean resolveSystemPropertyReferences)
defaults
- -resolveSystemPropertyReferences
- flag to indicate whether System property references (e.g.${user.home}) are to be resolved when loading the propertiespublic MyProperties(MyProperties.SKIPAUTOLOAD skipAutoLoad)
skipAutoLoad
- not used, except to distinguish this constructor from otherspublic static java.lang.String getOptionalProperty(java.util.Properties properties, java.lang.String key) throws NotFoundException
properties
- The Properties from which to return the value mapped to the named keykey
- The key whose mapped value is to be returnedNotFoundException
- If the given key value has no mapping in the given Propertiespublic static java.lang.String getPropertiesBaseName(java.lang.Class<? extends java.util.Properties> propertiesClass)
propertiesClass
- the class for which the corresponding properties resource name is to be returnedpublic static java.lang.String getRequiredProperty(java.util.Properties properties, java.lang.String key)
properties
- The propertieskey
- The key name of the required property to be obtainedpublic static java.lang.String resolveSystemPropertyRefs(java.lang.String propertyValue)
propertyValue
- The String value to be resolved for System Property referencespublic final java.lang.String getOptionalProperty(java.lang.String key) throws NotFoundException
key
- The key whose mapped value is to be returnedNotFoundException
- If the given key value has no mapping in the given Propertiespublic final java.lang.String getRequiredProperty(java.lang.String key)
key
- The key name of the required property to be obtained