Package lazyj
Class FallbackProperties
java.lang.Object
java.util.Observable
lazyj.ExtProperties
lazyj.FallbackProperties
- All Implemented Interfaces:
java.util.Observer
public class FallbackProperties extends ExtProperties
- Since:
- May 14, 2018
- Author:
- costing
-
Constructor Summary
Constructors Constructor Description FallbackProperties(java.util.List<ExtProperties> configProperties)
A different way of passing the ordered list of configuration sets to look intoFallbackProperties(ExtProperties... configProperties)
Query the given list of configuration sets in order, returning the first defined value in one of them -
Method Summary
Modifier and Type Method Description void
addProvider(ExtProperties config)
Append a provider to the fallback list (having thus the lowest priority)void
addProvider(ExtProperties config, boolean first)
Add another provider to the fallback list, either as the first element (with the highest priority) or as the last one (lowest priority).java.util.Properties
getProperties()
Get a Properties view of this object.java.lang.String
gets(java.lang.String sKey, java.lang.String sDefault, boolean bProcessQueries)
Get the String value for a given key, returning the given default value if the key is not defined.boolean
isReadOnly()
Check if the configuration object is read only or can accept modifications to itvoid
removeProvider(ExtProperties config)
Remove a provider from the fallback listvoid
set(java.lang.String sKey, java.lang.String sValue)
Modify an entry of the dictionary.Methods inherited from class lazyj.ExtProperties
addPropertyChangeListener, clearCache, getb, getConfigFileName, getd, geti, getl, gets, gets, makeReadOnly, parseOption, reload, removePropertyChangeListener, setAutoReload, size, toString, toVector, update
-
Constructor Details
-
FallbackProperties
Query the given list of configuration sets in order, returning the first defined value in one of them- Parameters:
configProperties
-
-
FallbackProperties
A different way of passing the ordered list of configuration sets to look into- Parameters:
configProperties
-
-
-
Method Details
-
addProvider
Append a provider to the fallback list (having thus the lowest priority)- Parameters:
config
-
-
addProvider
Add another provider to the fallback list, either as the first element (with the highest priority) or as the last one (lowest priority).- Parameters:
config
-first
-true
for a high priority provider,false
for a low priority one
-
removeProvider
Remove a provider from the fallback list- Parameters:
config
-
-
gets
public java.lang.String gets(java.lang.String sKey, java.lang.String sDefault, boolean bProcessQueries)Description copied from class:ExtProperties
Get the String value for a given key, returning the given default value if the key is not defined. The value that is returned is also stored in a cache so that future requests to the same key will return the value from the cache. This also means that if the key is not defined then the given default value will be cached and returned the next time this function is called.null
values are not cached.- Overrides:
gets
in classExtProperties
- Parameters:
sKey
- the key to get the value forsDefault
- default value to return in case the key is not defined.bProcessQueries
- flag to process or not process the database/memory cache queries- Returns:
- value for this key
-
set
public void set(java.lang.String sKey, java.lang.String sValue)Description copied from class:ExtProperties
Modify an entry of the dictionary.- Overrides:
set
in classExtProperties
- Parameters:
sKey
- key to changesValue
- new value
-
isReadOnly
public boolean isReadOnly()Description copied from class:ExtProperties
Check if the configuration object is read only or can accept modifications to it- Overrides:
isReadOnly
in classExtProperties
- Returns:
true
if changes are blocked
-
getProperties
public java.util.Properties getProperties()Description copied from class:ExtProperties
Get a Properties view of this object. This will force a parsing of all the defined keys.- Overrides:
getProperties
in classExtProperties
- Returns:
- a Properties view of this object
-