org.oddjob.arooa.standard
Class StandardPropertyManager

java.lang.Object
  extended by org.oddjob.arooa.standard.StandardPropertyManager
All Implemented Interfaces:
PropertyLookup, PropertyManager

public class StandardPropertyManager
extends Object
implements PropertyManager

Standard implementation of a PropertyManager.

Author:
rob

Constructor Summary
StandardPropertyManager()
          Default Constructor.
StandardPropertyManager(Properties properties, String source)
          Constructor with some properties.
StandardPropertyManager(PropertyManager parent)
          Constructor the defers first to a parent.
StandardPropertyManager(PropertyManager parent, Properties properties, String source)
          Constructor that defers first to parent, then to given properties.
 
Method Summary
 void addPropertyLookup(PropertyLookup propertyLookup)
          Add a lookup.
 void addPropertyOverride(PropertyLookup propertyLookup)
          Add a property overrides.
 String lookup(String propertyName)
          Return the value of a property, or null if it doesn't exist.
 Set<String> propertyNames()
          Return all property names in this property lookup.
 void removePropertyLookup(PropertyLookup propertyLookup)
          Remove a lookup.
 PropertySource sourceFor(String propertyName)
          Return a source for the property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardPropertyManager

public StandardPropertyManager()
Default Constructor. Initially only system properties are available.


StandardPropertyManager

public StandardPropertyManager(Properties properties,
                               String source)
Constructor with some properties. System properties will override given properties.

Parameters:
properties -
source - The name of the source of the properties.

StandardPropertyManager

public StandardPropertyManager(PropertyManager parent)
Constructor the defers first to a parent. No system properties will be returned unless by the parent.

Parameters:
parent -

StandardPropertyManager

public StandardPropertyManager(PropertyManager parent,
                               Properties properties,
                               String source)
Constructor that defers first to parent, then to given properties.

Parameters:
parent -
properties -
source - The name of the source of the properties.
Method Detail

addPropertyLookup

public void addPropertyLookup(PropertyLookup propertyLookup)
Description copied from interface: PropertyManager
Add a lookup. Lookups are used in the order they are added.

Specified by:
addPropertyLookup in interface PropertyManager

addPropertyOverride

public void addPropertyOverride(PropertyLookup propertyLookup)
Description copied from interface: PropertyManager
Add a property overrides. Overrides are used first.

Specified by:
addPropertyOverride in interface PropertyManager

removePropertyLookup

public void removePropertyLookup(PropertyLookup propertyLookup)
Description copied from interface: PropertyManager
Remove a lookup.

Specified by:
removePropertyLookup in interface PropertyManager

lookup

public String lookup(String propertyName)
Description copied from interface: PropertyLookup
Return the value of a property, or null if it doesn't exist.

Specified by:
lookup in interface PropertyLookup
Parameters:
propertyName - The name of the property.
Returns:
The value or null.

propertyNames

public Set<String> propertyNames()
Description copied from interface: PropertyLookup
Return all property names in this property lookup.

Specified by:
propertyNames in interface PropertyLookup
Returns:
The property names. Never null.

sourceFor

public PropertySource sourceFor(String propertyName)
Description copied from interface: PropertyLookup
Return a source for the property.

Specified by:
sourceFor in interface PropertyLookup
Parameters:
propertyName - The property name.
Returns:
The source, or null if the property isn't known.