Class ExtendedProperties

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,​java.lang.Object>

    public class ExtendedProperties
    extends java.util.Properties
    This implementation supports parameters substitution in property value.
    Version:
    $Id$
    See Also:
    getProperty(String), Serialized Form
    • Field Summary

      • Fields inherited from class java.util.Properties

        defaults
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getProperty​(java.lang.String key)
      Any parameter like ${propertyName} in property value will be replaced with the value of property with name propertyName.
      java.lang.String getProperty​(java.lang.String key, java.lang.String defaultValue)  
      ExtendedProperties getSubset​(java.lang.String prefix)  
      ExtendedProperties getSubset​(java.lang.String prefix, java.lang.String newPrefix)  
      • Methods inherited from class java.util.Properties

        clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ExtendedProperties

        public ExtendedProperties()
        See Also:
        Properties()
      • ExtendedProperties

        public ExtendedProperties​(java.util.Properties defs)
        See Also:
        Properties(java.util.Properties)
    • Method Detail

      • getProperty

        public java.lang.String getProperty​(java.lang.String key)
        Any parameter like ${propertyName} in property value will be replaced with the value of property with name propertyName.

        For example, for the following set of properties:

         param1=abcd
         param2=efgh
         param3=Alphabet starts with: ${param1}${param2}
         
        The call props.getProperty("param3") returns:
        Alphabet starts with: abcdefgh
        Note also that call props.get("param3") returns:
        Alphabet starts with: ${param1}${param2}
        So the Map.get(java.lang.Object) works as usual and returns raw (not expanded with substituted parameters) property value.

        Overrides:
        getProperty in class java.util.Properties
        See Also:
        Properties.getProperty(java.lang.String)
      • getProperty

        public java.lang.String getProperty​(java.lang.String key,
                                            java.lang.String defaultValue)
        Overrides:
        getProperty in class java.util.Properties
        See Also:
        Properties.getProperty(java.lang.String, java.lang.String)
      • getSubset

        public ExtendedProperties getSubset​(java.lang.String prefix)
        Parameters:
        prefix - string, each property key should start with (this prefix will NOT be included into new key)
        Returns:
        sub-properties
      • getSubset

        public ExtendedProperties getSubset​(java.lang.String prefix,
                                            java.lang.String newPrefix)
        Parameters:
        prefix - string, each property key should start with
        newPrefix - new prefix to be added to each key instead of existing prefix
        Returns:
        sub-properties