Class Configuration

  • All Implemented Interfaces:
    java.util.Map<java.lang.String,​java.lang.String>

    public class Configuration
    extends java.lang.Object
    implements java.util.Map<java.lang.String,​java.lang.String>
    Wrapper around the Properties class with supprt for Heirarchical confogurations and more functionality. Except for the getXXXX methods, all other Map Interface methods operate on the current (non-parent) collection and do NOT touch the parent.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Configuration.StringKeyMatcher
      Utility class to hold data for getKeys(java.util.regex.Pattern) method.
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.regex.Pattern COMMA_SEPARATOR  
      static java.lang.String[] EMPTY_LIST  
    • Constructor Summary

      Constructors 
      Constructor Description
      Configuration​(java.lang.Class theClass)
      Creates an empty Configuration
      Configuration​(java.lang.Class theClass, Configuration parent)
      Creates a new COnfiguration that uses parent as its parent Configuration.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)  
      java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.String>> entrySet()  
      java.lang.String get​(java.lang.Object key)  
      boolean getBoolean​(java.lang.String key, boolean Default)
      Returns a boolean from the configuration
      java.awt.Color getColor​(java.lang.String key, java.awt.Color Default)
      return the Color that has the given key or the Default
      int getInteger​(java.lang.String key, int Default)
      Gets an integer from the properties.
      java.util.Set<Configuration.StringKeyMatcher> getKeys​(java.util.regex.Pattern pattern)
      Obtain a set of all keys (and parent's keys) that match the given pattern.
      java.lang.String[] getPropertyList​(java.lang.String key)
      Returns a String[] of the comma separated items in the value.
      java.lang.String getString​(java.lang.String key)
      Get a string from this object or one of its parents.
      java.lang.String getString​(java.lang.String key, java.lang.String defaultValue)
      Returns a non-null value either by traversing the current and parent(s) map, or returning the defaultValue
      boolean isEmpty()  
      java.util.Set<java.lang.String> keySet()  
      java.lang.String put​(java.lang.String key, java.lang.String value)  
      void putAll​(java.util.Map config)  
      java.lang.String remove​(java.lang.Object key)  
      int size()  
      java.util.Set<java.lang.String> stringPropertyNames()
      Returns ALL property names from this Configuration's parents and this Configuration.
      java.lang.String toString()  
      java.util.Collection<java.lang.String> values()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Field Detail

      • EMPTY_LIST

        public static final java.lang.String[] EMPTY_LIST
      • COMMA_SEPARATOR

        public static final java.util.regex.Pattern COMMA_SEPARATOR
    • Constructor Detail

      • Configuration

        public Configuration​(java.lang.Class theClass,
                             Configuration parent)
        Creates a new COnfiguration that uses parent as its parent Configuration.
        Parameters:
        theClass -
        parent -
      • Configuration

        public Configuration​(java.lang.Class theClass)
        Creates an empty Configuration
        Parameters:
        theClass -
    • Method Detail

      • getString

        public java.lang.String getString​(java.lang.String key)
        Get a string from this object or one of its parents. If nothing is found, null is returned. If the Regex ${key} is found, then it is replaced by the value of that key within this (or parent's) map. Special COnstructs in ${}:
      • class_path will be replaced by the name of the Configuration (usually ClassName) with "." replaced by "/", and then converted to all lowercase
      • class_simpleName
      • is replaced by class.SimpleName
Parameters:
key -
Returns: