eu.beesoft.gaia.util
Class AdvancedProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by eu.beesoft.gaia.util.AdvancedProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class AdvancedProperties
extends java.util.Properties

This class enhances a functionality of java.util.Properties - it brings the expandable values. Expandable value is a value that contains some text between ${ and } marks. This text is seen as the name of the other property, which value is completed to the returned value.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
AdvancedProperties()
          Creates a new advanced properties.
AdvancedProperties(java.util.Properties properties)
          Creates a new advanced properties.
 
Method Summary
 java.lang.String getProperty(java.lang.String name)
          Returns a value of the property with given name.
 java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Returns a value of the property with given name.
 AdvancedProperties getSubset(java.lang.String prefix)
          Returns an instance of AdvancedProperties, which contains all properties of this instance they names start with iven prefix.
 
Methods inherited from class java.util.Properties
list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AdvancedProperties

public AdvancedProperties()
Creates a new advanced properties.


AdvancedProperties

public AdvancedProperties(java.util.Properties properties)
Creates a new advanced properties.

Parameters:
properties - - parent properties for this instance
Method Detail

getSubset

public AdvancedProperties getSubset(java.lang.String prefix)
Returns an instance of AdvancedProperties, which contains all properties of this instance they names start with iven prefix.

Parameters:
prefix - - name prefix for properties lookup
Returns:
new instance of AdvancedProperties with found properties

getProperty

public java.lang.String getProperty(java.lang.String name,
                                    java.lang.String defaultValue)
Returns a value of the property with given name. If this value is expandable, it is expanded before returning - each substring ${...} is replaced by value of the property which name is contained between marks.

Overrides:
getProperty in class java.util.Properties
Parameters:
name - - the property name
defaultValue - - the default value, returned if no such property found
Returns:
value of the property with given name or defaultValue if such property not found

getProperty

public java.lang.String getProperty(java.lang.String name)
Returns a value of the property with given name. If this value is expandable, it is expanded before returning - each substring ${...} is replaced by value of the property which name is contained between marks.

Overrides:
getProperty in class java.util.Properties
Parameters:
name - - the property name
Returns:
value of the property with given name