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 Details

    • DBProperties

      public DBProperties​(DBFunctions connection)
      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

      public DBProperties​(DBFunctions connection, ExtProperties parentConfig)
      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 class ExtProperties
      Parameters:
      sKey - the key to get the value for
      sDefault - 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 class ExtProperties
      Parameters:
      sKey - key to change
      sValue - new value