|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造函数 | 方法 | 详细信息: 字段 | 构造函数 | 方法 | |||||||||
java.lang.Objecttot.xml.AbstractConfiguration
public abstract class AbstractConfiguration
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 |
| 字段详细信息 |
|---|
protected Configuration defaults
protected static final java.lang.String START_TOKEN
protected static final java.lang.String END_TOKEN
| 构造函数详细信息 |
|---|
public AbstractConfiguration()
public AbstractConfiguration(Configuration defaults)
defaults - Configuration defaults to use if key not in file| 方法详细信息 |
|---|
public void addProperty(java.lang.String key,
java.lang.Object token)
Configuration 中的 addPropertykey - The Key to add the property to.token - The Value to add.protected abstract java.lang.Object getPropertyDirect(java.lang.String key)
null if the key doesn't
map to an existing object.
key - key to use for mapping
protected abstract void addPropertyDirect(java.lang.String key,
java.lang.Object obj)
key - key to use for mappingobj - object to storeprotected java.lang.String interpolate(java.lang.String base)
base - string to interpolate
protected java.lang.String interpolateHelper(java.lang.String base,
java.util.List priorVariables)
base - string with the ${key} variablespriorVariables - 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.
protected java.util.List processString(java.lang.String token)
token - The String to tokenize
protected final java.lang.Boolean testBoolean(java.lang.String value)
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.public Configuration subset(java.lang.String prefix)
Configuration 中的 subsetprefix - prefix string for keys
null if there is no such keys.public abstract boolean isEmpty()
Configuration 中的 isEmptytrue if Configuration is empty,
false otherwise.public abstract boolean containsKey(java.lang.String key)
Configuration 中的 containsKeykey - the configuration key
true if Configuration contain given key,
false otherwise.
public void setProperty(java.lang.String key,
java.lang.Object value)
Configuration 中的 setPropertykey - the configuration keyvalue - the property valuepublic abstract void clearProperty(java.lang.String key)
Configuration 中的 clearPropertykey - the key to remove along with corresponding value.public abstract java.util.Iterator getKeys()
Configuration 中的 getKeyspublic java.util.Iterator getKeys(java.lang.String prefix)
Configuration 中的 getKeysprefix - The prefix to test against.
public java.util.Properties getProperties(java.lang.String key)
Configuration 中的 getPropertieskey - The configuration key.
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)
public java.util.Properties getProperties(java.lang.String key,
java.util.Properties defaults)
key - The configuration key.defaults - Any default values for the returned
Properties object. Ignored if null.
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).public java.lang.Object getProperty(java.lang.String key)
Configuration 中的 getPropertykey - property to retrieve
public boolean getBoolean(java.lang.String key)
Configuration 中的 getBooleankey - The configuration key.
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.
public boolean getBoolean(java.lang.String key,
boolean defaultValue)
Configuration 中的 getBooleankey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a Boolean.
public java.lang.Boolean getBoolean(java.lang.String key,
java.lang.Boolean defaultValue)
Configuration 中的 getBooleankey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a Boolean.public byte getByte(java.lang.String key)
Configuration 中的 getBytekey - The configuration key.
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.
public byte getByte(java.lang.String key,
byte defaultValue)
Configuration 中的 getBytekey - The configuration key.defaultValue - The default value.
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.
public java.lang.Byte getByte(java.lang.String key,
java.lang.Byte defaultValue)
Configuration 中的 getBytekey - The configuration key.defaultValue - The default value.
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.public double getDouble(java.lang.String key)
Configuration 中的 getDoublekey - The configuration key.
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.
public double getDouble(java.lang.String key,
double defaultValue)
Configuration 中的 getDoublekey - The configuration key.defaultValue - The default value.
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.
public java.lang.Double getDouble(java.lang.String key,
java.lang.Double defaultValue)
Configuration 中的 getDoublekey - The configuration key.defaultValue - The default value.
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.public float getFloat(java.lang.String key)
Configuration 中的 getFloatkey - The configuration key.
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.
public float getFloat(java.lang.String key,
float defaultValue)
Configuration 中的 getFloatkey - The configuration key.defaultValue - The default value.
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.
public java.lang.Float getFloat(java.lang.String key,
java.lang.Float defaultValue)
Configuration 中的 getFloatkey - The configuration key.defaultValue - The default value.
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.public int getInt(java.lang.String key)
Configuration 中的 getIntkey - The configuration key.
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.
public int getInt(java.lang.String key,
int defaultValue)
Configuration 中的 getIntkey - The configuration key.defaultValue - The default value.
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.
public java.lang.Integer getInteger(java.lang.String key,
java.lang.Integer defaultValue)
Configuration 中的 getIntegerkey - The configuration key.defaultValue - The default value.
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.public long getLong(java.lang.String key)
Configuration 中的 getLongkey - The configuration key.
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.
public long getLong(java.lang.String key,
long defaultValue)
Configuration 中的 getLongkey - The configuration key.defaultValue - The default value.
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.
public java.lang.Long getLong(java.lang.String key,
java.lang.Long defaultValue)
Configuration 中的 getLongkey - The configuration key.defaultValue - The default value.
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.public short getShort(java.lang.String key)
Configuration 中的 getShortkey - The configuration key.
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.
public short getShort(java.lang.String key,
short defaultValue)
Configuration 中的 getShortkey - The configuration key.defaultValue - The default value.
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.
public java.lang.Short getShort(java.lang.String key,
java.lang.Short defaultValue)
Configuration 中的 getShortkey - The configuration key.defaultValue - The default value.
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.public java.lang.String getString(java.lang.String key)
Configuration 中的 getStringkey - The configuration key.
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.
public java.lang.String getString(java.lang.String key,
java.lang.String defaultValue)
Configuration 中的 getStringkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an object that
is not a String.public java.lang.String[] getStringArray(java.lang.String key)
Configuration 中的 getStringArraykey - The configuration key.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a String/Vector of Strings.public java.util.Vector getVector(java.lang.String key)
Configuration 中的 getVectorkey - The configuration key.
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.
public java.util.Vector getVector(java.lang.String key,
java.util.Vector defaultValue)
Configuration 中的 getVectorkey - The configuration key.defaultValue - The default value.
java.lang.ClassCastException - is thrown if the key maps to an
object that is not a Vector.
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造函数 | 方法 | 详细信息: 字段 | 构造函数 | 方法 | |||||||||