|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.configuration.tree.DefaultConfigurationKey
A simple class that supports creation of and iteration on configuration keys
supported by a
object.
DefaultExpressionEngine
For key creation the class works similar to a StringBuffer: There are several
appendXXXX()
methods with which single parts of a key can be
constructed. All these methods return a reference to the actual object so
they can be written in a chain. When using this methods the exact syntax for
keys need not be known.
This class also defines a specialized iterator for configuration keys. With such an iterator a key can be tokenized into its single parts. For each part it can be checked whether it has an associated index.
Instances of this class are always associated with an instance of
, from which the current
delimiters are obtained. So key creation and parsing is specific to this
associated expression engine.
DefaultExpressionEngine
Nested Class Summary | |
class |
DefaultConfigurationKey.KeyIterator
A specialized iterator class for tokenizing a configuration key. |
Constructor Summary | |
DefaultConfigurationKey(DefaultExpressionEngine engine)
Creates a new instance of DefaultConfigurationKey and sets
the associated expression engine. |
|
DefaultConfigurationKey(DefaultExpressionEngine engine,
String key)
Creates a new instance of DefaultConfigurationKey and sets
the associated expression engine and an initial key. |
Method Summary | |
DefaultConfigurationKey |
append(String property)
Appends the name of a property to this key. |
DefaultConfigurationKey |
append(String property,
boolean escape)
Appends the name of a property to this key. |
DefaultConfigurationKey |
appendAttribute(String attr)
Appends an attribute to this configuration key. |
DefaultConfigurationKey |
appendIndex(int index)
Appends an index to this configuration key. |
String |
attributeName(String key)
Extracts the name of the attribute from the given attribute key. |
String |
constructAttributeKey(String key)
Decorates the given key so that it represents an attribute. |
boolean |
equals(Object c)
Checks if two ConfigurationKey objects are equal. |
DefaultExpressionEngine |
getExpressionEngine()
Returns the associated default expression engine. |
int |
hashCode()
Returns the hash code for this object. |
boolean |
isAttributeKey(String key)
Tests if the specified key represents an attribute according to the current expression engine. |
DefaultConfigurationKey.KeyIterator |
iterator()
Returns an iterator for iterating over the single components of this configuration key. |
int |
length()
Returns the actual length of this configuration key. |
void |
setExpressionEngine(DefaultExpressionEngine expressionEngine)
Sets the associated expression engine. |
void |
setLength(int len)
Sets the new length of this configuration key. |
String |
toString()
Returns a string representation of this object. |
String |
trim(String key)
Removes delimiters at the beginning and the end of the specified key. |
String |
trimLeft(String key)
Removes leading property delimiters from the specified key. |
String |
trimRight(String key)
Removes trailing property delimiters from the specified key. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DefaultConfigurationKey(DefaultExpressionEngine engine)
DefaultConfigurationKey
and sets
the associated expression engine.
engine
- the expression enginepublic DefaultConfigurationKey(DefaultExpressionEngine engine, String key)
DefaultConfigurationKey
and sets
the associated expression engine and an initial key.
engine
- the expression enginekey
- the key to be wrappedMethod Detail |
public DefaultExpressionEngine getExpressionEngine()
public void setExpressionEngine(DefaultExpressionEngine expressionEngine)
expressionEngine
- the expression engine (must not be null)public DefaultConfigurationKey append(String property, boolean escape)
property
- the name of the property to be addedescape
- a flag if property delimiters in the passed in property name
should be escaped
public DefaultConfigurationKey append(String property)
property
- the name of the property to be added
public DefaultConfigurationKey appendIndex(int index)
index
- the index to be appended
public DefaultConfigurationKey appendAttribute(String attr)
attr
- the name of the attribute to be appended
public int length()
public void setLength(int len)
append()
methods. The semantic is the same as the
setLength()
method of StringBuffer
.
len
- the new length of the keypublic boolean equals(Object c)
ConfigurationKey
objects are equal. The
method can be called with strings or other objects, too.
c
- the object to compare
public int hashCode()
public String toString()
public boolean isAttributeKey(String key)
key
- the key to be checked
public String constructAttributeKey(String key)
key
- the key to be decorated
public String attributeName(String key)
key
- the attribute key
public String trimLeft(String key)
key
- the key
public String trimRight(String key)
key
- the key
public String trim(String key)
key
- the key
public DefaultConfigurationKey.KeyIterator iterator()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |