Package org.frankframework.util
Class PropertyLoader
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Object,
Object>
- Direct Known Subclasses:
AppConstants
,CredentialConstants
- See Also:
-
Field Summary
Fields inherited from class java.util.Properties
defaults
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyLoader
(ClassLoader classLoader, String propertiesFile) PropertyLoader
(String propertiesFile) -
Method Summary
Modifier and TypeMethodDescriptionboolean
getBoolean
(String key, boolean dfault) Gets aboolean
value Returns "true" if the retrieved value is "true", otherwise "false" Uses thegetResolvedProperty(String)
method.double
Gets adouble
value Uses thegetResolvedProperty(String)
method.int
Gets anint
value Uses thegetResolvedProperty(String)
method.getListProperty
(String key) Retrieves a list property value associated with the specified key.getListProperty
(String key, String defaults) Retrieves a list property value associated with the specified key.long
Gets along
value Uses thegetResolvedProperty(String)
method.<T extends Enum<T>>
TgetOrDefault
(String key, T dfault) getProperty
(String key) protected final String
the method is like theProperties.getProperty
, but provides functionality to resolve${variable}
Syntaxes.Gets aString
value Uses thegetResolvedProperty(String)
method.protected void
load
(ClassLoader classLoader, String filename) Load the contents of a properties file.Deprecated.Methods inherited from class java.util.Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, getOrDefault, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
Constructor Details
-
PropertyLoader
-
PropertyLoader
-
-
Method Details
-
get
-
getProperty
- Overrides:
getProperty
in classProperties
-
getUnresolvedProperty
-
getResolvedProperty
the method is like theProperties.getProperty
, but provides functionality to resolve${variable}
Syntaxes. It uses the property values and system values to resolve the variables, and does so recursively.- See Also:
-
getOrDefault
-
getListProperty
Retrieves a list property value associated with the specified key. The method first resolves the property value using thegetResolvedProperty(String)
method. If the resolved property value is null, an empty list is returned.- Parameters:
key
- the key of the property value to retrieve- Returns:
- a list of string values associated with the specified key, or an empty list if the resolved property is null
-
getListProperty
Retrieves a list property value associated with the specified key. The method first resolves the property value using thegetResolvedProperty(String)
method. If the resolved property value is null, it returns the list of string values provided as "defaults".- Parameters:
key
- the key of the property value to retrievedefaults
- the default list of string values to return if the resolved property is null- Returns:
- a list of string values associated with the specified key, or the default list if the resolved property is null. If the defaults is also null, then returns an empty list.
-
put
Deprecated.UseProperties.setProperty(String, String)
instead!Add property only in the local PropertyLoader! Do not use this method and useProperties.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 underlyingHashtable
. -
load
Load the contents of a properties file.Optionally, this may be a comma-separated list of files to load, e.g.
log4j2.properties,DeploymentSpecifics.properties
which will cause both files to be loaded in the listed order. -
getString
Gets aString
value Uses thegetResolvedProperty(String)
method.- Parameters:
key
- the Keydfault
- the default value- Returns:
- String
-
getBoolean
Gets aboolean
value Returns "true" if the retrieved value is "true", otherwise "false" Uses thegetResolvedProperty(String)
method.- Parameters:
key
- the Keydfault
- the default value- Returns:
- double
-
getInt
Gets anint
value Uses thegetResolvedProperty(String)
method.- Parameters:
key
- the Keydfault
- the default value- Returns:
- int
-
getLong
Gets along
value Uses thegetResolvedProperty(String)
method.- Parameters:
key
- the Keydfault
- the default value- Returns:
- long
-
getDouble
Gets adouble
value Uses thegetResolvedProperty(String)
method.- Parameters:
key
- the Keydfault
- the default value- Returns:
- double
-
Properties.setProperty(String, String)
instead!