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 into
    FallbackProperties​(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 it
    void removeProvider​(ExtProperties config)
    Remove a provider from the fallback list
    void set​(java.lang.String sKey, java.lang.String sValue)
    Modify an entry of the dictionary.

    Methods inherited from class java.util.Observable

    addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FallbackProperties

      public FallbackProperties​(ExtProperties... configProperties)
      Query the given list of configuration sets in order, returning the first defined value in one of them
      Parameters:
      configProperties -
    • FallbackProperties

      public FallbackProperties​(java.util.List<ExtProperties> configProperties)
      A different way of passing the ordered list of configuration sets to look into
      Parameters:
      configProperties -
  • Method Details

    • addProvider

      public void addProvider​(ExtProperties config)
      Append a provider to the fallback list (having thus the lowest priority)
      Parameters:
      config -
    • addProvider

      public 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).
      Parameters:
      config -
      first - true for a high priority provider, false for a low priority one
    • removeProvider

      public void removeProvider​(ExtProperties config)
      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 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
    • 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 class ExtProperties
      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 class ExtProperties
      Returns:
      a Properties view of this object