public final class AppConstants extends Properties implements Serializable
When an instance is created, it tries to load the properties file specified
by the propertiesFileName
field
If a property exits with the name ADDITIONAL.PROPERTIES.FILE
that file is loaded also
Modifier and Type | Field and Description |
---|---|
protected Logger |
log |
defaults
Modifier and Type | Method and Description |
---|---|
String |
get(Object key) |
Properties |
getAppConstants(String keyBase)
Returns a list of
AppConstants which names begin with the keyBase |
Properties |
getAppConstants(String keyBase,
boolean useSystemProperties,
boolean useEnvironmentVariables)
Returns a list of
AppConstants which names begin with the keyBase |
boolean |
getBoolean(String key,
boolean dfault)
Gets a
boolean value
Returns "true" if the retrieved value is "true", otherwise "false"
Uses the getResolvedProperty(String) method. |
double |
getDouble(String key,
double dfault)
Gets a
double value
Uses the getResolvedProperty(String) method. |
static AppConstants |
getInstance()
Return the AppConstants root instance
|
static AppConstants |
getInstance(ClassLoader cl)
Retrieve an instance based on a ClassLoader.
|
int |
getInt(String key,
int dfault)
Gets an
int value
Uses the getResolvedProperty(String) method. |
long |
getLong(String key,
long dfault)
Gets a
long value
Uses the getResolvedProperty(String) method. |
String |
getProperty(String key) |
String |
getResolvedProperty(String key)
the method is like the
Properties.getProperty , but provides functionality to resolve ${variable}
syntaxis. |
String |
getString(String key,
String dfault)
Gets a
String value
Uses the getResolvedProperty(String) method. |
StringTokenizer |
getTokenizedProperty(String key)
Creates a tokenizer from the resolved value of this key.
|
StringTokenizer |
getTokenizedProperty(String key,
String defaults)
Creates a tokenizer from the resolved value of this key.
|
String |
getUnresolvedProperty(String key) |
Object |
put(Object key,
Object value)
Deprecated.
Use
setProperty(String, String) instead! |
void |
put(String key,
String value)
Add property to global (all) AppConstants
|
static void |
removeInstance() |
static void |
removeInstance(ClassLoader cl) |
Object |
setProperty(String key,
boolean value) |
Object |
setProperty(String key,
String value)
Add property to global AppConstants
|
getProperty, list, list, load, load, loadFromXML, propertyNames, save, store, store, storeToXML, storeToXML, stringPropertyNames
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keys, keySet, merge, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
protected Logger log
public static AppConstants getInstance()
public static AppConstants getInstance(ClassLoader cl)
cl
- ClassLoader to retrieve AppConstants frompublic static void removeInstance()
public static void removeInstance(ClassLoader cl)
public String getProperty(String key)
getProperty
in class Properties
public String getResolvedProperty(String key)
Properties.getProperty
, but provides functionality to resolve ${variable}
syntaxis. It uses the AppConstants values and systemvalues to resolve the variables, and does this recursively.public StringTokenizer getTokenizedProperty(String key)
getResolvedProperty(String)
method.
Can be used to process lists of values.public StringTokenizer getTokenizedProperty(String key, String defaults)
getResolvedProperty(String)
method.
Can be used to process lists of values.public Properties getAppConstants(String keyBase)
AppConstants
which names begin with the keyBasepublic Properties getAppConstants(String keyBase, boolean useSystemProperties, boolean useEnvironmentVariables)
AppConstants
which names begin with the keyBase@Deprecated public Object put(Object key, Object value)
setProperty(String, String)
instead!setProperty(String, String)
if you want to set the property globally!
This method is used by Properties.load(InputStream)
to add all properties found (in a file/stream)
to the Hashtable
.public Object setProperty(String key, String value)
setProperty
in class Properties
public String getString(String key, String dfault)
String
value
Uses the getResolvedProperty(String)
method.key
- the Keydfault
- the default valuepublic boolean getBoolean(String key, boolean dfault)
boolean
value
Returns "true" if the retrieved value is "true", otherwise "false"
Uses the getResolvedProperty(String)
method.key
- the Keydfault
- the default valuepublic int getInt(String key, int dfault)
int
value
Uses the getResolvedProperty(String)
method.key
- the Keydfault
- the default valuepublic long getLong(String key, long dfault)
long
value
Uses the getResolvedProperty(String)
method.key
- the Keydfault
- the default valuepublic double getDouble(String key, double dfault)
double
value
Uses the getResolvedProperty(String)
method.key
- the Keydfault
- the default valueCopyright © 2023 Frank!Framework. All rights reserved.