Oracle

com.compoze.util
Class MutableProperties

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 com.compoze.util.ObjectProperties
                  extended by com.compoze.util.MutableProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>
Direct Known Subclasses:
FileProperties, ResourceProperties

public class MutableProperties
extends ObjectProperties
implements java.io.Serializable

This class provides a properties object that can change the response for its values based on a named configuration. An example listing of properties is as follows:

 # default property
 link.yahoo = http://www.yahoo.com/

 # property used for named configuration "europe"
 europe-link.yahoo = http://www.europe.yahoo.com/
 

So, for example, the value for link.yahoo in the named configuration europe would be http://www.europe.yahoo.com/. In the named configuration asia the value would default to http://www.yahoo.com/. Named configurations are listed in order of precedence.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
MutableProperties()
          Constructor.
MutableProperties(java.util.LinkedList configuration)
          Constructor.
MutableProperties(java.util.Properties defaults)
          Constructor.
MutableProperties(java.util.Properties defaults, java.util.LinkedList configuration)
          Constructor.
 
Method Summary
 java.lang.String getProperty(java.lang.String sKey)
          Get a property.
 java.lang.String getProperty(java.lang.String sKey, java.lang.String sDefault)
          Get a property.
 java.util.Enumeration propertyNames()
          This method overrides the same method in java.util.Properties, and returns property names without their mutable property prefixes.
 void setConfiguration(java.util.LinkedList configuration)
          Set the current configuration.
 
Methods inherited from class com.compoze.util.ObjectProperties
getBoolean, getBoolean, getByte, getByte, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, getString, getString, getStringArray, getStringArray, getStringArray, replaceSubstitutions
 
Methods inherited from class java.util.Properties
list, list, load, loadFromXML, 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

MutableProperties

public MutableProperties()
Constructor.


MutableProperties

public MutableProperties(java.util.Properties defaults)
Constructor.

Parameters:
defaults - default properties

MutableProperties

public MutableProperties(java.util.LinkedList configuration)
Constructor.

Parameters:
configuration - the list of configurations to set (in order of precedence)

MutableProperties

public MutableProperties(java.util.Properties defaults,
                         java.util.LinkedList configuration)
Constructor.

Parameters:
defaults - default properties
configuration - the list of configurations to set (in order of precedence)
Method Detail

propertyNames

public java.util.Enumeration propertyNames()
This method overrides the same method in java.util.Properties, and returns property names without their mutable property prefixes.

Overrides:
propertyNames in class java.util.Properties
Returns:
the enumeration of property names without their mutable property prefixes

setConfiguration

public void setConfiguration(java.util.LinkedList configuration)
Set the current configuration.

Parameters:
configuration - the list of configurations to set (in order of precedence)

getProperty

public java.lang.String getProperty(java.lang.String sKey)
Get a property. If a configuration is set and a value for that configuration is available then that is returned, otherwise the default value is returned.

Overrides:
getProperty in class ObjectProperties
Parameters:
sKey - the key of the property
Returns:
the value

getProperty

public java.lang.String getProperty(java.lang.String sKey,
                                    java.lang.String sDefault)
Get a property. If a configuration is set and a value for that configuration is available then that is returned, otherwise the default value is returned.

Overrides:
getProperty in class ObjectProperties
Parameters:
sKey - the key of the property
sDefault - the default to return if a value for the configuration is not found
Returns:
the value

Oracle

Copyright ©1999-2008 Oracle All rights reserved.