Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.configuration
Interface Configuration  view Configuration download Configuration.java

All Known Subinterfaces:
FileConfiguration
All Known Implementing Classes:
AbstractConfiguration, AbstractFileConfiguration, HierarchicalXMLConfiguration

public interface Configuration

Configuration interface.

Version:
$Id: Configuration.java,v 1.10 2004/08/16 22:16:31 henning Exp $

Method Summary
 void addProperty(java.lang.String key, java.lang.Object value)
          Add a property to the configuration.
 void clearProperty(java.lang.String key)
          Remove a property from the configuration.
 boolean containsKey(java.lang.String key)
          Check if the configuration contains the specified key.
 java.math.BigDecimal getBigDecimal(java.lang.String key)
          Get a java.math.BigDecimal associated with the given configuration key.
 java.math.BigDecimal getBigDecimal(java.lang.String key, java.math.BigDecimal defaultValue)
          Get a java.math.BigDecimal associated with the given configuration key.
 java.math.BigInteger getBigInteger(java.lang.String key)
          Get a java.math.BigInteger associated with the given configuration key.
 java.math.BigInteger getBigInteger(java.lang.String key, java.math.BigInteger defaultValue)
          Get a java.math.BigInteger associated with the given configuration key.
 boolean getBoolean(java.lang.String key)
          Get a boolean associated with the given configuration key.
 boolean getBoolean(java.lang.String key, boolean defaultValue)
          Get a boolean associated with the given configuration key.
 java.lang.Boolean getBoolean(java.lang.String key, java.lang.Boolean defaultValue)
          Get a java.lang.Boolean associated with the given configuration key.
 byte getByte(java.lang.String key)
          Get a byte associated with the given configuration key.
 byte getByte(java.lang.String key, byte defaultValue)
          Get a byte associated with the given configuration key.
 java.lang.Byte getByte(java.lang.String key, java.lang.Byte defaultValue)
          Get a java.lang.Byte associated with the given configuration key.
 double getDouble(java.lang.String key)
          Get a double associated with the given configuration key.
 double getDouble(java.lang.String key, double defaultValue)
          Get a double associated with the given configuration key.
 java.lang.Double getDouble(java.lang.String key, java.lang.Double defaultValue)
          Get a java.lang.Double associated with the given configuration key.
 float getFloat(java.lang.String key)
          Get a float associated with the given configuration key.
 float getFloat(java.lang.String key, float defaultValue)
          Get a float associated with the given configuration key.
 java.lang.Float getFloat(java.lang.String key, java.lang.Float defaultValue)
          Get a java.lang.Float associated with the given configuration key.
 int getInt(java.lang.String key)
          Get a int associated with the given configuration key.
 int getInt(java.lang.String key, int defaultValue)
          Get a int associated with the given configuration key.
 java.lang.Integer getInteger(java.lang.String key, java.lang.Integer defaultValue)
          Get an java.lang.Integer associated with the given configuration key.
 java.util.Iterator getKeys()
          Get the list of the keys contained in the configuration.
 java.util.Iterator getKeys(java.lang.String prefix)
          Get the list of the keys contained in the configuration that match the specified prefix.
 java.util.List getList(java.lang.String key)
          Get a List of strings associated with the given configuration key.
 java.util.List getList(java.lang.String key, java.util.List defaultValue)
          Get a List of strings associated with the given configuration key.
 long getLong(java.lang.String key)
          Get a long associated with the given configuration key.
 long getLong(java.lang.String key, long defaultValue)
          Get a long associated with the given configuration key.
 java.lang.Long getLong(java.lang.String key, java.lang.Long defaultValue)
          Get a java.lang.Long associated with the given configuration key.
 java.util.Properties getProperties(java.lang.String key)
          Get a list of properties associated with the given configuration key.
 java.lang.Object getProperty(java.lang.String key)
          Gets a property from the configuration.
 short getShort(java.lang.String key)
          Get a short associated with the given configuration key.
 short getShort(java.lang.String key, short defaultValue)
          Get a short associated with the given configuration key.
 java.lang.Short getShort(java.lang.String key, java.lang.Short defaultValue)
          Get a java.lang.Short associated with the given configuration key.
 java.lang.String getString(java.lang.String key)
          Get a string associated with the given configuration key.
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
          Get a string associated with the given configuration key.
 java.lang.String[] getStringArray(java.lang.String key)
          Get an array of strings associated with the given configuration key.
 java.util.Vector getVector(java.lang.String key)
          Deprecated. This method is for compatibility with applications that use the pre-1.0 versions of commons-configuration. It will be removed post 1.0
 java.util.Vector getVector(java.lang.String key, java.util.Vector defaultValue)
          Deprecated. This method is for compatibility with applications that use the pre-1.0 versions of commons-configuration. It will be removed post 1.0
 boolean isEmpty()
          Check if the configuration is empty.
 void setProperty(java.lang.String key, java.lang.Object value)
          Set a property, this will replace any previously set values.
 Configuration subset(java.lang.String prefix)
          Return a decorator Configuration containing every key from the current Configuration that starts with the specified prefix.
 

Method Detail

subset

public Configuration subset(java.lang.String prefix)
Return a decorator Configuration containing every key from the current Configuration that starts with the specified prefix. The prefix is removed from the keys in the subset. For example, if the configuration contains the following properties:
    prefix.number = 1
    prefix.string = Apache
    prefixed.foo = bar
    prefix = Jakarta
the Configuration returned by subset("prefix") will contain the properties:
    number = 1
    string = Apache
    = Jakarta
(The key for the value "Jakarta" is an empty string)

Since the subset is a decorator and not a modified copy of the initial Configuration, any change made to the subset is available to the Configuration, and reciprocally.


isEmpty

public boolean isEmpty()
Check if the configuration is empty.


containsKey

public boolean containsKey(java.lang.String key)
Check if the configuration contains the specified key.


addProperty

public void addProperty(java.lang.String key,
                        java.lang.Object value)
Add a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, if the property:
resource.loader = file
is already present in the configuration and you call
addProperty("resource.loader", "classpath")
Then you will end up with a List like the following:
["file", "classpath"]


setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Set a property, this will replace any previously set values. Set values is implicitly a call to clearProperty(key), addProperty(key, value).


clearProperty

public void clearProperty(java.lang.String key)
Remove a property from the configuration.


getProperty

public java.lang.Object getProperty(java.lang.String key)
Gets a property from the configuration.


getKeys

public java.util.Iterator getKeys(java.lang.String prefix)
Get the list of the keys contained in the configuration that match the specified prefix.


getKeys

public java.util.Iterator getKeys()
Get the list of the keys contained in the configuration.


getProperties

public java.util.Properties getProperties(java.lang.String key)
Get a list of properties associated with the given configuration key.


getBoolean

public boolean getBoolean(java.lang.String key)
Get a boolean associated with the given configuration key.


getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defaultValue)
Get a boolean associated with the given configuration key.


getBoolean

public java.lang.Boolean getBoolean(java.lang.String key,
                                    java.lang.Boolean defaultValue)
                             throws java.lang.NoClassDefFoundError
Get a java.lang.Boolean associated with the given configuration key.


getByte

public byte getByte(java.lang.String key)
Get a byte associated with the given configuration key.


getByte

public byte getByte(java.lang.String key,
                    byte defaultValue)
Get a byte associated with the given configuration key.


getByte

public java.lang.Byte getByte(java.lang.String key,
                              java.lang.Byte defaultValue)
Get a java.lang.Byte associated with the given configuration key.


getDouble

public double getDouble(java.lang.String key)
Get a double associated with the given configuration key.


getDouble

public double getDouble(java.lang.String key,
                        double defaultValue)
Get a double associated with the given configuration key.


getDouble

public java.lang.Double getDouble(java.lang.String key,
                                  java.lang.Double defaultValue)
Get a java.lang.Double associated with the given configuration key.


getFloat

public float getFloat(java.lang.String key)
Get a float associated with the given configuration key.


getFloat

public float getFloat(java.lang.String key,
                      float defaultValue)
Get a float associated with the given configuration key.


getFloat

public java.lang.Float getFloat(java.lang.String key,
                                java.lang.Float defaultValue)
Get a java.lang.Float associated with the given configuration key.


getInt

public int getInt(java.lang.String key)
Get a int associated with the given configuration key.


getInt

public int getInt(java.lang.String key,
                  int defaultValue)
Get a int associated with the given configuration key.


getInteger

public java.lang.Integer getInteger(java.lang.String key,
                                    java.lang.Integer defaultValue)
Get an java.lang.Integer associated with the given configuration key.


getLong

public long getLong(java.lang.String key)
Get a long associated with the given configuration key.


getLong

public long getLong(java.lang.String key,
                    long defaultValue)
Get a long associated with the given configuration key.


getLong

public java.lang.Long getLong(java.lang.String key,
                              java.lang.Long defaultValue)
Get a java.lang.Long associated with the given configuration key.


getShort

public short getShort(java.lang.String key)
Get a short associated with the given configuration key.


getShort

public short getShort(java.lang.String key,
                      short defaultValue)
Get a short associated with the given configuration key.


getShort

public java.lang.Short getShort(java.lang.String key,
                                java.lang.Short defaultValue)
Get a java.lang.Short associated with the given configuration key.


getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String key)
Get a java.math.BigDecimal associated with the given configuration key.


getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String key,
                                          java.math.BigDecimal defaultValue)
Get a java.math.BigDecimal associated with the given configuration key.


getBigInteger

public java.math.BigInteger getBigInteger(java.lang.String key)
Get a java.math.BigInteger associated with the given configuration key.


getBigInteger

public java.math.BigInteger getBigInteger(java.lang.String key,
                                          java.math.BigInteger defaultValue)
Get a java.math.BigInteger associated with the given configuration key.


getString

public java.lang.String getString(java.lang.String key)
Get a string associated with the given configuration key.


getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultValue)
Get a string associated with the given configuration key.


getStringArray

public java.lang.String[] getStringArray(java.lang.String key)
Get an array of strings associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned


getList

public java.util.List getList(java.lang.String key)
Get a List of strings associated with the given configuration key. If the key doesn't map to an existing object an empty List is returned.


getList

public java.util.List getList(java.lang.String key,
                              java.util.List defaultValue)
Get a List of strings associated with the given configuration key.


getVector

public java.util.Vector getVector(java.lang.String key)
Deprecated. This method is for compatibility with applications that use the pre-1.0 versions of commons-configuration. It will be removed post 1.0

Get a Vector of strings associated with the given configuration key. If the key doesn't map to an existing object an empty Vector is returned.


getVector

public java.util.Vector getVector(java.lang.String key,
                                  java.util.Vector defaultValue)
Deprecated. This method is for compatibility with applications that use the pre-1.0 versions of commons-configuration. It will be removed post 1.0

Get a Vector of strings associated with the given configuration key.