You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by eb...@apache.org on 2004/06/16 20:13:53 UTC
cvs commit: jakarta-commons/configuration/src/java/org/apache/commons/configuration AbstractConfiguration.java BasePropertiesConfiguration.java Configuration.java ConfigurationFactory.java DOM4JConfiguration.java DOMConfiguration.java SubsetConfiguration.java
ebourg 2004/06/16 11:13:53
Modified: configuration/src/java/org/apache/commons/configuration
AbstractConfiguration.java
BasePropertiesConfiguration.java Configuration.java
ConfigurationFactory.java DOM4JConfiguration.java
DOMConfiguration.java SubsetConfiguration.java
Log:
javadoc update
Revision Changes Path
1.11 +44 -83 jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java
Index: AbstractConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AbstractConfiguration.java 15 Jun 2004 15:53:58 -0000 1.10
+++ AbstractConfiguration.java 16 Jun 2004 18:13:53 -0000 1.11
@@ -211,7 +211,7 @@
//variable not defined - so put it back in the value
result.append(START_TOKEN).append(variable).append(END_TOKEN);
}
-
+
prec = end;
}
result.append(base.substring(prec + END_TOKEN.length(), base.length()));
@@ -349,9 +349,9 @@
* @return The associated properties if key is found.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a String/List.
+ * object that is not a String/List.
* @throws IllegalArgumentException if one of the tokens is
- * malformed (does not contain an equals sign).
+ * malformed (does not contain an equals sign).
*
* @see #getProperties(String, Properties)
*/
@@ -361,8 +361,7 @@
}
/**
- * Get a list of properties associated with the given
- * configuration key.
+ * Get a list of properties associated with the given configuration key.
*
* @param key The configuration key.
* @param defaults Any default values for the returned
@@ -371,9 +370,10 @@
* @return The associated properties if key is found.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a String/List of Strings.
+ * object that is not a String/List of Strings.
+ *
* @throws IllegalArgumentException if one of the tokens is
- * malformed (does not contain an equals sign).
+ * malformed (does not contain an equals sign).
*/
public Properties getProperties(String key, Properties defaults)
{
@@ -530,8 +530,6 @@
* map to an existing object.
* @throws ConversionException is thrown if the key maps to an
* object that is not a Byte.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
*/
public byte getByte(String key)
{
@@ -557,8 +555,6 @@
*
* @throws ConversionException is thrown if the key maps to an
* object that is not a Byte.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
*/
public byte getByte(String key, byte defaultValue)
{
@@ -576,8 +572,6 @@
*
* @throws ConversionException is thrown if the key maps to an object that
* is not a Byte.
- * @throws NumberFormatException is thrown if the value mapped by the key
- * has not a valid number format.
*/
public Byte getByte(String key, Byte defaultValue)
{
@@ -620,8 +614,6 @@
* map to an existing object.
* @throws ConversionException is thrown if the key maps to an
* object that is not a Double.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
*/
public double getDouble(String key)
{
@@ -647,8 +639,6 @@
*
* @throws ConversionException is thrown if the key maps to an
* object that is not a Double.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
*/
public double getDouble(String key, double defaultValue)
{
@@ -666,8 +656,6 @@
*
* @throws ConversionException is thrown if the key maps to an
* object that is not a Double.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
*/
public Double getDouble(String key, Double defaultValue)
{
@@ -703,15 +691,13 @@
* Get a float associated with the given configuration key.
*
* @param key The configuration key.
- *
* @return The associated float.
*
* @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
+ * map to an existing object.
+ *
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Float.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Float.
*/
public float getFloat(String key)
{
@@ -732,13 +718,10 @@
*
* @param key The configuration key.
* @param defaultValue The default value.
- *
* @return The associated float.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Float.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Float.
*/
public float getFloat(String key, float defaultValue)
{
@@ -750,14 +733,11 @@
*
* @param key The configuration key.
* @param defaultValue The default value.
- *
* @return The associated float if key is found and has valid
- * format, default value otherwise.
+ * format, default value otherwise.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Float.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Float.
*/
public Float getFloat(String key, Float defaultValue)
{
@@ -793,15 +773,13 @@
* Get a int associated with the given configuration key.
*
* @param key The configuration key.
- *
* @return The associated int.
*
* @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
+ * map to an existing object.
+ *
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Integer.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Integer.
*/
public int getInt(String key)
{
@@ -822,13 +800,10 @@
*
* @param key The configuration key.
* @param defaultValue The default value.
- *
* @return The associated int.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Integer.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Integer.
*/
public int getInt(String key, int defaultValue)
{
@@ -853,8 +828,6 @@
*
* @throws ConversionException is thrown if the key maps to an object that
* is not a Integer.
- * @throws NumberFormatException is thrown if the value mapped by the key
- * has not a valid number format.
*/
public Integer getInteger(String key, Integer defaultValue)
{
@@ -894,11 +867,10 @@
* @return The associated long.
*
* @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
+ * map to an existing object.
+ *
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Long.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Long.
*/
public long getLong(String key)
{
@@ -923,9 +895,7 @@
* @return The associated long.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Long.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Long.
*/
public long getLong(String key, long defaultValue)
{
@@ -939,12 +909,10 @@
* @param defaultValue The default value.
*
* @return The associated long if key is found and has valid
- * format, default value otherwise.
+ * format, default value otherwise.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Long.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Long.
*/
public Long getLong(String key, Long defaultValue)
{
@@ -984,11 +952,9 @@
* @return The associated short.
*
* @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
+ * map to an existing object.
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Short.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Short.
*/
public short getShort(String key)
{
@@ -1013,9 +979,7 @@
* @return The associated short.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Short.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Short.
*/
public short getShort(String key, short defaultValue)
{
@@ -1029,12 +993,10 @@
* @param defaultValue The default value.
*
* @return The associated short if key is found and has valid
- * format, default value otherwise.
+ * format, default value otherwise.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a Short.
- * @throws NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * object that is not a Short.
*/
public Short getShort(String key, Short defaultValue)
{
@@ -1159,7 +1121,8 @@
* @return The associated string.
*
* @throws ConversionException is thrown if the key maps to an object that
- * is not a String.
+ * is not a String.
+ *
* @throws NoSuchElementException is thrown if the key doesn't
* map to an existing object.
*/
@@ -1186,7 +1149,7 @@
* @return The associated string if key is found, default value otherwise.
*
* @throws ConversionException is thrown if the key maps to an object that
- * is not a String.
+ * is not a String.
*/
public String getString(String key, String defaultValue)
{
@@ -1208,15 +1171,14 @@
}
/**
- * Get an array of strings associated with the given configuration
- * key.
+ * Get an array of strings associated with the given configuration key.
*
* @param key The configuration key.
*
* @return The associated string array if key is found.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a String/List of Strings.
+ * object that is not a String/List of Strings.
*/
public String[] getStringArray(String key)
{
@@ -1259,7 +1221,8 @@
* @return The associated List.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a List.
+ * object that is not a List.
+ *
* @throws NoSuchElementException is thrown if the key doesn't
* map to an existing object.
*/
@@ -1286,7 +1249,7 @@
* @return The associated List.
*
* @throws ConversionException is thrown if the key maps to an
- * object that is not a List.
+ * object that is not a List.
*/
public List getList(String key, List defaultValue)
{
@@ -1304,8 +1267,8 @@
}
else if (value instanceof List)
{
- list = (List)value;
- }
+ list = (List) value;
+ }
else if (value == null)
{
list = ((defaultValue == null) ? new ArrayList() : defaultValue);
@@ -1331,7 +1294,7 @@
* @param key The property key.
*
* @return value Value, transparently resolving a possible
- * Container dependency.
+ * Container dependency.
*/
private Object resolveContainerStore(String key)
{
@@ -1407,7 +1370,7 @@
private List list = null;
/**
- * C'tor
+ * Constructor
*/
public Container()
{
@@ -1456,11 +1419,9 @@
}
/**
- * Returns the Elements of the Container as
- * a List. This is not the internal list
- * element but a shallow copy of the internal
- * list. You may modify the returned list without
- * modifying the container.
+ * Returns the Elements of the Container as a List. This is not the
+ * internal list element but a shallow copy of the internal list. You
+ * may modify the returned list without modifying the container.
*
* @return A List containing the elements of the Container.
*/
1.11 +9 -5 jakarta-commons/configuration/src/java/org/apache/commons/configuration/BasePropertiesConfiguration.java
Index: BasePropertiesConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/BasePropertiesConfiguration.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BasePropertiesConfiguration.java 15 Jun 2004 11:49:25 -0000 1.10
+++ BasePropertiesConfiguration.java 16 Jun 2004 18:13:53 -0000 1.11
@@ -136,6 +136,7 @@
* Load the properties from the given input stream.
*
* @param input An InputStream.
+ *
* @throws ConfigurationException
*/
public void load(InputStream input)
@@ -150,7 +151,8 @@
*
* @param input An InputStream.
* @param encoding An encoding.
- * @exception ConfigurationException
+ *
+ * @throws ConfigurationException
*/
public synchronized void load(InputStream input, String encoding) throws ConfigurationException
{
@@ -222,6 +224,7 @@
* properties with multiple values are saved comma seperated.
*
* @param filename name of the properties file
+ *
* @throws ConfigurationException
*/
public void save(String filename) throws ConfigurationException
@@ -334,7 +337,7 @@
*
* @return A string containing a property value or null
*
- * @exception IOException
+ * @throws IOException
*/
public String readProperty() throws IOException
{
@@ -393,7 +396,7 @@
*
* @param key
* @param value
- * @exception IOException
+ * @throws IOException
*/
public void writeProperty(String key, Object value) throws IOException
{
@@ -427,7 +430,7 @@
* Write a comment.
*
* @param comment
- * @exception IOException
+ * @throws IOException
*/
public void writeComment(String comment) throws IOException
{
@@ -442,6 +445,7 @@
* drop escaped commas (i.e '\,').
*
* @param str the <code>String</code> to unescape, may be null
+ *
* @throws IllegalArgumentException if the Writer is <code>null</code>
*/
protected static String unescapeJava(String str) {
1.7 +194 -175 jakarta-commons/configuration/src/java/org/apache/commons/configuration/Configuration.java
Index: Configuration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/Configuration.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Configuration.java 15 Jun 2004 15:53:58 -0000 1.6
+++ Configuration.java 16 Jun 2004 18:13:53 -0000 1.7
@@ -1,5 +1,3 @@
-package org.apache.commons.configuration;
-
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
@@ -16,70 +14,95 @@
* limitations under the License.
*/
+package org.apache.commons.configuration;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
import java.util.NoSuchElementException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
+import java.util.Properties;
/**
* Configuration interface.
- * The general idea here is to make something that will work like our
- * extended properties and be compatible with the preferences API if at all
- * possible.
*
* @version $Id$
*/
public interface Configuration
{
/**
- * Create an Configuration object that is a subset
- * of this one. The new Configuration object contains every key from
- * the current Configuration that starts with prefix. The prefix is
- * removed from the keys in the subset.
+ * 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:
+ *
+ * <pre>
+ * prefix.number = 1
+ * prefix.string = Apache
+ * prefixed.foo = bar
+ * prefix = Jakarta</pre>
+ *
+ * the Configuration returned by <code>subset("prefix")</code> will contain
+ * the properties:
+ *
+ * <pre>
+ * number = 1
+ * string = Apache
+ * = Jakarta</pre>
+ *
+ * (The key for the value "Jakarta" is an empty string)
+ * <p>
+ * 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.
*
* @param prefix The prefix used to select the properties.
+ *
+ * @see SubsetConfiguration
*/
Configuration subset(String prefix);
/**
* Check if the configuration is empty.
*
- * @return true is the configuration contains no key/value pair, false otherwise
+ * @return <code>true</code> if the configuration contains no property,
+ * <code>false</code> otherwise.
*/
boolean isEmpty();
/**
- * Check if the configuration contains the key.
+ * Check if the configuration contains the specified key.
+ *
+ * @param key the key whose presence in this configuration is to be tested
*
- * @return true is the configuration contains a value for this key, false otherwise
+ * @return <code>true</code> if the configuration contains a value for this
+ * key, <code>false</code> otherwise
*/
boolean containsKey(String key);
/**
* 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
+ * <pre>resource.loader = file</pre>
*
- * is already present in the configuration and you
+ * is already present in the configuration and you call
*
- * addProperty("resource.loader", "classpath")
+ * <pre>addProperty("resource.loader", "classpath")</pre>
*
* Then you will end up with a List like the following:
*
- * ["file", "classpath"]
+ * <pre>["file", "classpath"]</pre>
*
- * @param key The Key to add the property to.
- * @param value The Value to add.
+ * @param key The key to add the property to.
+ * @param value The value to add.
*/
void addProperty(String key, Object value);
/**
- * Set a property, this will replace any previously
- * set values. Set values is implicitly a call
- * to clearProperty(key), addProperty(key,value).
+ * Set a property, this will replace any previously set values. Set values
+ * is implicitly a call to clearProperty(key), addProperty(key, value).
*
* @param key The key of the property to change
* @param value The new value
@@ -87,24 +110,24 @@
void setProperty(String key, Object value);
/**
- * Clear a property in the configuration.
+ * Remove a property from the configuration.
*
* @param key the key to remove along with corresponding value.
*/
void clearProperty(String key);
/**
- * Gets a property from the configuration.
+ * Gets a property from the configuration.
*
- * @param key property to retrieve
- * @return value as object. Will return user value if exists,
- * if not then default value if exists, otherwise null
+ * @param key property to retrieve
+ * @return the value to which this configuration maps the specified key, or
+ * null if the configuration contains no mapping for this key.
*/
Object getProperty(String key);
/**
- * Get the list of the keys contained in the configuration
- * repository that match the specified prefix.
+ * Get the list of the keys contained in the configuration that match the
+ * specified prefix.
*
* @param prefix The prefix to test against.
* @return An Iterator of keys that match the prefix.
@@ -112,38 +135,37 @@
Iterator getKeys(String prefix);
/**
- * Get the list of the keys contained in the configuration
- * repository.
+ * Get the list of the keys contained in the configuration.
*
* @return An Iterator.
*/
Iterator getKeys();
/**
- * Get a list of properties associated with the given
- * configuration key.
+ * Get a list of properties associated with the given configuration key.
*
* @param key The configuration key.
* @return The associated properties if key is found.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a String/List.
- * @exception IllegalArgumentException if one of the tokens is
- * malformed (does not contain an equals sign).
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a String/List.
+ *
+ * @throws IllegalArgumentException if one of the tokens is
+ * malformed (does not contain an equals sign).
*/
Properties getProperties(String key);
- // We probably want to at least try to be compatible with
- // the new preferences API.
-
/**
* Get a boolean associated with the given configuration key.
*
* @param key The configuration key.
* @return The associated boolean.
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Boolean.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Boolean.
*/
boolean getBoolean(String key);
@@ -153,34 +175,36 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated boolean.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Boolean.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Boolean.
*/
boolean getBoolean(String key, boolean defaultValue);
/**
- * Get a boolean associated with the given configuration key.
+ * Get a {@link Boolean} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated boolean if key is found and has valid
- * format, default value otherwise.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Boolean.
+ * format, default value otherwise.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Boolean.
*/
- Boolean getBoolean(String key, Boolean defaultValue);
+ Boolean getBoolean(String key, Boolean defaultValue) throws NoClassDefFoundError;
/**
* Get a byte associated with the given configuration key.
*
* @param key The configuration key.
* @return The associated byte.
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Byte.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Byte.
*/
byte getByte(String key);
@@ -190,24 +214,22 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated byte.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Byte.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Byte.
*/
byte getByte(String key, byte defaultValue);
/**
- * Get a byte associated with the given configuration key.
+ * Get a {@link Byte} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated byte if key is found and has valid format, default
* value otherwise.
- * @exception ConversionException is thrown if the key maps to an object that
- * is not a Byte.
- * @exception NumberFormatException is thrown if the value mapped by the key
- * has not a valid number format.
+ *
+ * @throws ConversionException is thrown if the key maps to an object that
+ * is not a Byte.
*/
Byte getByte(String key, Byte defaultValue);
@@ -216,12 +238,12 @@
*
* @param key The configuration key.
* @return The associated double.
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Double.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Double.
*/
double getDouble(String key);
@@ -231,24 +253,22 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated double.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Double.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Double.
*/
double getDouble(String key, double defaultValue);
/**
- * Get a double associated with the given configuration key.
+ * Get a {@link Double} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated double if key is found and has valid
- * format, default value otherwise.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Double.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * format, default value otherwise.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Double.
*/
Double getDouble(String key, Double defaultValue);
@@ -257,12 +277,11 @@
*
* @param key The configuration key.
* @return The associated float.
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Float.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Float.
*/
float getFloat(String key);
@@ -272,24 +291,22 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated float.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Float.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Float.
*/
float getFloat(String key, float defaultValue);
/**
- * Get a float associated with the given configuration key.
+ * Get a {@link Float} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated float if key is found and has valid
- * format, default value otherwise.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Float.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ * format, default value otherwise.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Float.
*/
Float getFloat(String key, Float defaultValue);
@@ -298,12 +315,12 @@
*
* @param key The configuration key.
* @return The associated int.
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Integer.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Integer.
*/
int getInt(String key);
@@ -313,24 +330,22 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated int.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Integer.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Integer.
*/
int getInt(String key, int defaultValue);
/**
- * Get a int associated with the given configuration key.
+ * Get an {@link Integer} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated int if key is found and has valid format, default
* value otherwise.
- * @exception ConversionException is thrown if the key maps to an object that
+ *
+ * @throws ConversionException is thrown if the key maps to an object that
* is not a Integer.
- * @exception NumberFormatException is thrown if the value mapped by the key
- * has not a valid number format.
*/
Integer getInteger(String key, Integer defaultValue);
@@ -339,12 +354,12 @@
*
* @param key The configuration key.
* @return The associated long.
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Long.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Long.
*/
long getLong(String key);
@@ -354,24 +369,22 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated long.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Long.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Long.
*/
long getLong(String key, long defaultValue);
/**
- * Get a long associated with the given configuration key.
+ * Get a {@link Long} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated long if key is found and has valid
* format, default value otherwise.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Long.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Long.
*/
Long getLong(String key, Long defaultValue);
@@ -380,12 +393,12 @@
*
* @param key The configuration key.
* @return The associated short.
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Short.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Short.
*/
short getShort(String key);
@@ -395,72 +408,70 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated short.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Short.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Short.
*/
short getShort(String key, short defaultValue);
/**
- * Get a short associated with the given configuration key.
+ * Get a {@link Short} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated short if key is found and has valid
- * format, default value otherwise.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a Short.
- * @exception NumberFormatException is thrown if the value mapped
- * by the key has not a valid number format.
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
+ * format, default value otherwise.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a Short.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
*/
Short getShort(String key, Short defaultValue);
/**
- * Get a BigDecimal associated with the given configuration key.
+ * Get a {@link BigDecimal} associated with the given configuration key.
*
* @param key The configuration key.
- *
* @return The associated BigDecimal if key is found and has valid format
*
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
*/
- BigDecimal getBigDecimal(String key) throws NoSuchElementException;
+ BigDecimal getBigDecimal(String key);
/**
- * Get a BigDecimal associated with the given configuration key.
+ * Get a {@link BigDecimal} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
*
* @return The associated BigDecimal if key is found and has valid
- * format, default value otherwise.
+ * format, default value otherwise.
*/
BigDecimal getBigDecimal(String key, BigDecimal defaultValue);
/**
- * Get a BigInteger associated with the given configuration key.
+ * Get a {@link BigInteger} associated with the given configuration key.
*
* @param key The configuration key.
*
* @return The associated BigInteger if key is found and has valid format
*
- * @exception NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
*/
- BigInteger getBigInteger(String key) throws NoSuchElementException;
+ BigInteger getBigInteger(String key);
/**
- * Get a BigInteger associated with the given configuration key.
+ * Get a {@link BigInteger} associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
*
* @return The associated BigInteger if key is found and has valid
- * format, default value otherwise.
+ * format, default value otherwise.
*/
BigInteger getBigInteger(String key, BigInteger defaultValue);
@@ -469,9 +480,11 @@
*
* @param key The configuration key.
* @return The associated string.
- * @exception ConversionException is thrown if the key maps to an object that
- * is not a String.
- * @exception NoSuchElementException is thrown if the key doesn't
+ *
+ * @throws ConversionException is thrown if the key maps to an object that
+ * is not a String.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
* map to an existing object.
*/
String getString(String key);
@@ -482,20 +495,21 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated string if key is found and has valid
- * format, default value otherwise.
- * @exception ConversionException is thrown if the key maps to an object that
- * is not a String.
+ * format, default value otherwise.
+ *
+ * @throws ConversionException is thrown if the key maps to an object that
+ * is not a String.
*/
String getString(String key, String defaultValue);
/**
- * Get an array of strings associated with the given configuration
- * key.
+ * Get an array of strings associated with the given configuration key.
*
* @param key The configuration key.
* @return The associated string array if key is found.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a String/List of Strings.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a String/List of Strings.
*/
String[] getStringArray(String key);
@@ -504,8 +518,12 @@
*
* @param key The configuration key.
* @return The associated List.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a List.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a List.
+ *
+ * @throws NoSuchElementException is thrown if the key doesn't
+ * map to an existing object.
*/
List getList(String key);
@@ -515,8 +533,9 @@
* @param key The configuration key.
* @param defaultValue The default value.
* @return The associated List.
- * @exception ConversionException is thrown if the key maps to an
- * object that is not a List.
+ *
+ * @throws ConversionException is thrown if the key maps to an
+ * object that is not a List.
*/
List getList(String key, List defaultValue);
}
1.11 +2 -2 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java
Index: ConfigurationFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ConfigurationFactory.java 2 Jun 2004 16:42:24 -0000 1.10
+++ ConfigurationFactory.java 16 Jun 2004 18:13:53 -0000 1.11
@@ -414,7 +414,7 @@
* Creates an instance of the specified class.
* @param attribs the attributes (ignored)
* @return the new object
- * @exception Exception if object creation fails
+ * @throws Exception if object creation fails
*/
public Object createObject(Attributes attribs) throws Exception
{
1.7 +5 -5 jakarta-commons/configuration/src/java/org/apache/commons/configuration/DOM4JConfiguration.java
Index: DOM4JConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/DOM4JConfiguration.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DOM4JConfiguration.java 15 Jun 2004 11:49:25 -0000 1.6
+++ DOM4JConfiguration.java 16 Jun 2004 18:13:53 -0000 1.7
@@ -93,7 +93,7 @@
* classpath.
*
* @param resource Name of the resource
- * @exception ConfigurationException If error reading data source.
+ * @throws ConfigurationException If error reading data source.
* @see DOM4JConfiguration#DOM4JConfiguration(File)
*/
public DOM4JConfiguration(String resource) throws ConfigurationException
@@ -106,7 +106,7 @@
* Attempts to load the XML file.
*
* @param file File object representing the XML file.
- * @exception ConfigurationException If error reading data source.
+ * @throws ConfigurationException If error reading data source.
*/
public DOM4JConfiguration(File file) throws ConfigurationException
{
@@ -123,7 +123,7 @@
}
catch (MalformedURLException mue){
throw new ConfigurationException("Could not load from " + getBasePath() + ", " + getFileName());
- }
+ }
catch (DocumentException de){
throw new ConfigurationException("Could not load from " + getBasePath() + ", " + getFileName());
}
@@ -370,7 +370,7 @@
{
this.fileName = fileName;
-
+
}
/**
1.4 +13 -13 jakarta-commons/configuration/src/java/org/apache/commons/configuration/DOMConfiguration.java
Index: DOMConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/DOMConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DOMConfiguration.java 15 Jun 2004 11:49:25 -0000 1.3
+++ DOMConfiguration.java 16 Jun 2004 18:13:53 -0000 1.4
@@ -91,7 +91,7 @@
* classpath.
*
* @param resource Name of the resource
- * @exception ConfigurationException If error reading data source.
+ * @throws ConfigurationException If error reading data source.
* @see DOMConfiguration#DOMConfiguration(String)
*/
public DOMConfiguration(String resource) throws ConfigurationException
@@ -104,7 +104,7 @@
* Attempts to load the XML file.
*
* @param file File object representing the XML file.
- * @exception ConfigurationException If error reading data source.
+ * @throws ConfigurationException If error reading data source.
*/
public DOMConfiguration(File file) throws ConfigurationException
{
@@ -168,14 +168,14 @@
final org.w3c.dom.Node w3cNode = list.item(i);
if(w3cNode instanceof Element)
{
- final StringBuffer subhierarchy =
+ final StringBuffer subhierarchy =
new StringBuffer(hierarchy.toString());
final Element child = (Element)w3cNode;
subhierarchy.append(child.getTagName());
processAttributes(subhierarchy.toString(), child);
- initProperties(child,
+ initProperties(child,
new StringBuffer(subhierarchy.toString()).append('.'));
- }
+ }
else if(w3cNode instanceof CharacterData)
{
final CharacterData data = (CharacterData)w3cNode;
@@ -206,7 +206,7 @@
if (w3cNode instanceof Attr)
{
Attr attr = (Attr) w3cNode;
- String attrName =
+ String attrName =
hierarchy + '[' + ATTRIB_MARKER + attr.getName() + ']';
super.addProperty(attrName, attr.getValue());
}
@@ -262,7 +262,7 @@
attName = eName.substring(index + ATTRIB_START_MARKER.length(), eName.length() - 1);
eName = eName.substring(0, index);
}
-
+
Element child = null;
final NodeList list = element.getChildNodes();
for (int j = 0; j < list.getLength(); j++)
@@ -328,7 +328,7 @@
attName = eName.substring(index + ATTRIB_START_MARKER.length(), eName.length() - 1);
eName = eName.substring(0, index);
}
-
+
final NodeList list = element.getChildNodes();
for (int j = 0; j < list.getLength(); j++) {
final org.w3c.dom.Node w3cNode = list.item(j);
@@ -433,7 +433,7 @@
{
this.fileName = fileName;
-
+
}
/**
@@ -444,13 +444,13 @@
{
return fileName;
}
-
+
public String toString() {
StringBuffer buffer = new StringBuffer();
toXML(document, buffer);
return buffer.toString();
}
-
+
private void toXML(final org.w3c.dom.Node element, final StringBuffer buffer)
{
final NodeList nodeList = element.getChildNodes();
@@ -472,7 +472,7 @@
buffer.append(">");
toXML(node, buffer);
buffer.append("</" + node.getNodeName() + ">");
- }
+ }
else if(node instanceof CharacterData)
{
final CharacterData data = (CharacterData)node;
1.3 +3 -1 jakarta-commons/configuration/src/java/org/apache/commons/configuration/SubsetConfiguration.java
Index: SubsetConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/SubsetConfiguration.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SubsetConfiguration.java 1 Apr 2004 18:43:04 -0000 1.2
+++ SubsetConfiguration.java 16 Jun 2004 18:13:53 -0000 1.3
@@ -26,6 +26,8 @@
* every key from the parent Configuration that starts with prefix. The prefix
* is removed from the keys in the subset.
*
+ * @see Configuration#subset(String)
+ *
* @author Emmanuel Bourg
* @version $Revision$, $Date$
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org