tot.xml
类 AbstractConfiguration

java.lang.Object
  继承者 tot.xml.AbstractConfiguration
所有已实现的接口:
Configuration
直接已知子类:
BaseConfiguration

public abstract class AbstractConfiguration
extends java.lang.Object
implements Configuration

Abstract configuration class. Provide basic functionality but does not store any data. If you want to write your own Configuration class then you should implement only abstract methods from this class.


字段摘要
protected  Configuration defaults
          stores the configuration key-value pairs
protected static java.lang.String END_TOKEN
          end token
protected static java.lang.String START_TOKEN
          start token
 
构造函数摘要
AbstractConfiguration()
          Empty constructor.
AbstractConfiguration(Configuration defaults)
          Creates an empty AbstractConfiguration object with a Super-Object which is queries for every key.
 
方法摘要
 void addProperty(java.lang.String key, java.lang.Object token)
          Add a property to the configuration.
protected abstract  void addPropertyDirect(java.lang.String key, java.lang.Object obj)
          Adds a key/value pair to the Configuration.
abstract  void clearProperty(java.lang.String key)
          Clear a property in the configuration.
abstract  boolean containsKey(java.lang.String key)
          check if the configuration contains the 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 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 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 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 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 a int associated with the given configuration key.
abstract  java.util.Iterator getKeys()
          Get the list of the keys contained in the configuration repository.
 java.util.Iterator getKeys(java.lang.String prefix)
          Get the list of the keys contained in the configuration repository that match the specified prefix.
 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 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.util.Properties getProperties(java.lang.String key, java.util.Properties defaults)
          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.
protected abstract  java.lang.Object getPropertyDirect(java.lang.String key)
          Read property.
 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 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)
          Get a Vector of strings associated with the given configuration key.
 java.util.Vector getVector(java.lang.String key, java.util.Vector defaultValue)
          Get a Vector of strings associated with the given configuration key.
protected  java.lang.String interpolate(java.lang.String base)
          interpolate key names to handle ${key} stuff
protected  java.lang.String interpolateHelper(java.lang.String base, java.util.List priorVariables)
          Recursive handler for multple levels of interpolation.
abstract  boolean isEmpty()
          Check if the configuration is empty
protected  java.util.List processString(java.lang.String token)
          Returns a Vector of Strings built from the supplied String.
 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)
          Create an BaseConfiguration object that is a subset of this one.
protected  java.lang.Boolean testBoolean(java.lang.String value)
          Test whether the string represent by value maps to a boolean value or not.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

defaults

protected Configuration defaults
stores the configuration key-value pairs


START_TOKEN

protected static final java.lang.String START_TOKEN
start token

另请参见:
常量字段值

END_TOKEN

protected static final java.lang.String END_TOKEN
end token

另请参见:
常量字段值
构造函数详细信息

AbstractConfiguration

public AbstractConfiguration()
Empty constructor.


AbstractConfiguration

public AbstractConfiguration(Configuration defaults)
Creates an empty AbstractConfiguration object with a Super-Object which is queries for every key.

参数:
defaults - Configuration defaults to use if key not in file
方法详细信息

addProperty

public void addProperty(java.lang.String key,
                        java.lang.Object token)
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 resource.loader = file is already present in the configuration and you addProperty("resource.loader", "classpath") Then you will end up with a Vector like the following: ["file", "classpath"]

指定者:
接口 Configuration 中的 addProperty
参数:
key - The Key to add the property to.
token - The Value to add.

getPropertyDirect

protected abstract java.lang.Object getPropertyDirect(java.lang.String key)
Read property. Should return null if the key doesn't map to an existing object.

参数:
key - key to use for mapping
返回:
object associated with the given configuration key.

addPropertyDirect

protected abstract void addPropertyDirect(java.lang.String key,
                                          java.lang.Object obj)
Adds a key/value pair to the Configuration. Override this method to provide write acces to underlying Configuration store.

参数:
key - key to use for mapping
obj - object to store

interpolate

protected java.lang.String interpolate(java.lang.String base)
interpolate key names to handle ${key} stuff

参数:
base - string to interpolate
返回:
returns the key name with the ${key} substituted

interpolateHelper

protected java.lang.String interpolateHelper(java.lang.String base,
                                             java.util.List priorVariables)
Recursive handler for multple levels of interpolation. When called the first time, priorVariables should be null.

参数:
base - string with the ${key} variables
priorVariables - serves two purposes: to allow checking for loops, and creating a meaningful exception message should a loop occur. It's 0'th element will be set to the value of base from the first call. All subsequent interpolated variables are added afterward.
返回:
the string with the interpolation taken care of

processString

protected java.util.List processString(java.lang.String token)
Returns a Vector of Strings built from the supplied String. Splits up CSV lists. If no commas are in the String, simply returns a Vector with the String as its first element

参数:
token - The String to tokenize
返回:
A List of Strings

testBoolean

protected final java.lang.Boolean testBoolean(java.lang.String value)
Test whether the string represent by value maps to a boolean value or not. We will allow true, on, and yes for a true boolean value, and false, off, and no for false boolean values. Case of value to test for boolean status is ignored.

参数:
value - The value to test for boolean state.
返回:
true or false if the supplied text maps to a boolean value, or null otherwise.

subset

public Configuration subset(java.lang.String prefix)
Create an BaseConfiguration object that is a subset of this one.

指定者:
接口 Configuration 中的 subset
参数:
prefix - prefix string for keys
返回:
subset of configuration if there is keys, that match given prefix, or null if there is no such keys.

isEmpty

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

指定者:
接口 Configuration 中的 isEmpty
返回:
true if Configuration is empty, false otherwise.

containsKey

public abstract boolean containsKey(java.lang.String key)
check if the configuration contains the key

指定者:
接口 Configuration 中的 containsKey
参数:
key - the configuration key
返回:
true if Configuration contain given key, false otherwise.

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).

指定者:
接口 Configuration 中的 setProperty
参数:
key - the configuration key
value - the property value

clearProperty

public abstract void clearProperty(java.lang.String key)
Clear a property in the configuration.

指定者:
接口 Configuration 中的 clearProperty
参数:
key - the key to remove along with corresponding value.

getKeys

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

指定者:
接口 Configuration 中的 getKeys
返回:
An Iterator.

getKeys

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

指定者:
接口 Configuration 中的 getKeys
参数:
prefix - The prefix to test against.
返回:
An Iterator of keys that match the prefix.

getProperties

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

指定者:
接口 Configuration 中的 getProperties
参数:
key - The configuration key.
返回:
The associated properties if key is found.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a String/Vector.
java.lang.IllegalArgumentException - if one of the tokens is malformed (does not contain an equals sign).
另请参见:
getProperties(String, Properties)

getProperties

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

参数:
key - The configuration key.
defaults - Any default values for the returned Properties object. Ignored if null.
返回:
The associated properties if key is found.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a String/Vector of Strings.
java.lang.IllegalArgumentException - if one of the tokens is malformed (does not contain an equals sign).

getProperty

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

指定者:
接口 Configuration 中的 getProperty
参数:
key - property to retrieve
返回:
value as object. Will return user value if exists, if not then default value if exists, otherwise null

getBoolean

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

指定者:
接口 Configuration 中的 getBoolean
参数:
key - The configuration key.
返回:
The associated boolean.
抛出:
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Boolean.

getBoolean

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

指定者:
接口 Configuration 中的 getBoolean
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated boolean.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Boolean.

getBoolean

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

指定者:
接口 Configuration 中的 getBoolean
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated boolean if key is found and has valid format, default value otherwise.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Boolean.

getByte

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

指定者:
接口 Configuration 中的 getByte
参数:
key - The configuration key.
返回:
The associated byte.
抛出:
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Byte.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getByte

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

指定者:
接口 Configuration 中的 getByte
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated byte.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Byte.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getByte

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

指定者:
接口 Configuration 中的 getByte
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated byte if key is found and has valid format, default value otherwise.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Byte.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getDouble

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

指定者:
接口 Configuration 中的 getDouble
参数:
key - The configuration key.
返回:
The associated double.
抛出:
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Double.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getDouble

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

指定者:
接口 Configuration 中的 getDouble
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated double.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Double.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getDouble

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

指定者:
接口 Configuration 中的 getDouble
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated double if key is found and has valid format, default value otherwise.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Double.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getFloat

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

指定者:
接口 Configuration 中的 getFloat
参数:
key - The configuration key.
返回:
The associated float.
抛出:
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Float.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getFloat

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

指定者:
接口 Configuration 中的 getFloat
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated float.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Float.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getFloat

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

指定者:
接口 Configuration 中的 getFloat
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated float if key is found and has valid format, default value otherwise.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Float.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getInt

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

指定者:
接口 Configuration 中的 getInt
参数:
key - The configuration key.
返回:
The associated int.
抛出:
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Integer.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getInt

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

指定者:
接口 Configuration 中的 getInt
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated int.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Integer.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getInteger

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

指定者:
接口 Configuration 中的 getInteger
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated int if key is found and has valid format, default value otherwise.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Integer.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getLong

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

指定者:
接口 Configuration 中的 getLong
参数:
key - The configuration key.
返回:
The associated long.
抛出:
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Long.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getLong

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

指定者:
接口 Configuration 中的 getLong
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated long.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Long.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getLong

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

指定者:
接口 Configuration 中的 getLong
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated long if key is found and has valid format, default value otherwise.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Long.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getShort

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

指定者:
接口 Configuration 中的 getShort
参数:
key - The configuration key.
返回:
The associated short.
抛出:
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Short.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getShort

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

指定者:
接口 Configuration 中的 getShort
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated short.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Short.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getShort

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

指定者:
接口 Configuration 中的 getShort
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated short if key is found and has valid format, default value otherwise.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Short.
java.lang.NumberFormatException - is thrown if the value mapped by the key has not a valid number format.

getString

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

指定者:
接口 Configuration 中的 getString
参数:
key - The configuration key.
返回:
The associated string.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a String.
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.

getString

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

指定者:
接口 Configuration 中的 getString
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated string if key is found, default value otherwise.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a String.

getStringArray

public java.lang.String[] getStringArray(java.lang.String key)
Get an array of strings associated with the given configuration key.

指定者:
接口 Configuration 中的 getStringArray
参数:
key - The configuration key.
返回:
The associated string array if key is found.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a String/Vector of Strings.

getVector

public java.util.Vector getVector(java.lang.String key)
Get a Vector of strings associated with the given configuration key.

指定者:
接口 Configuration 中的 getVector
参数:
key - The configuration key.
返回:
The associated Vector.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Vector.
java.util.NoSuchElementException - is thrown if the key doesn't map to an existing object.

getVector

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

指定者:
接口 Configuration 中的 getVector
参数:
key - The configuration key.
defaultValue - The default value.
返回:
The associated Vector.
抛出:
java.lang.ClassCastException - is thrown if the key maps to an object that is not a Vector.