Package lazyj
Class DBProperties
java.lang.Object
java.util.Observable
lazyj.ExtProperties
lazyj.DBProperties
- All Implemented Interfaces:
java.util.Observer
public class DBProperties extends ExtProperties
- Since:
- May 14, 2018
- Author:
- costing
-
Constructor Summary
Constructors Constructor Description DBProperties(DBFunctions connection)
Load the values from the specified database.DBProperties(DBFunctions connection, java.lang.String tableName, java.lang.String keyColumnName, java.lang.String valueColumnName, ExtProperties parentConfig)
Load the values from the specified database, table name, primary key column and value column.DBProperties(DBFunctions connection, ExtProperties parentConfig)
Load the values from the specified database. -
Method Summary
Modifier and Type Method Description 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.void
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, getProperties, gets, gets, isReadOnly, makeReadOnly, parseOption, reload, removePropertyChangeListener, setAutoReload, size, toString, toVector, update
-
Constructor Details
-
DBProperties
Load the values from the specified database. By default the table is assumed to be called "config" with a "configkey" primary key and a "configvalue" column to actually hold the values- Parameters:
connection
-
-
DBProperties
Load the values from the specified database. By default the table is assumed to be called "config" with a "configkey" primary key and a "configvalue" column to actually hold the values- Parameters:
connection
-parentConfig
- configuration set to fall back to when the database query doesn't return anything for the given key
-
DBProperties
public DBProperties(DBFunctions connection, java.lang.String tableName, java.lang.String keyColumnName, java.lang.String valueColumnName, ExtProperties parentConfig)Load the values from the specified database, table name, primary key column and value column.- Parameters:
connection
-tableName
-keyColumnName
-valueColumnName
-parentConfig
- configuration set to fall back to when the database query doesn't return anything for the given key
-
-
Method Details
-
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
-