A simple class that supports creation of and iteration on complex
configuration keys.
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.
commonKey(ConfigurationKey other) Returns a configuration key object that is initialized with the part
of the key that is common to this key and the passed in key.
Appends the name of a property to this key. If necessary, a
property delimiter will be added.
Parameters: property - the name of the property to be added a reference to this object
Extracts the name of the attribute from the given attribute key.
This method removes the attribute markers - if any - from the
specified key.
Parameters: key - the attribute key the name of the corresponding attribute
Returns a configuration key object that is initialized with the part
of the key that is common to this key and the passed in key.
Parameters: other - the other key a key object with the common key part
Decorates the given key so that it represents an attribute. Adds
special start and end markers.
Parameters: key - the key to be decorated the decorated attribute key
Returns the "difference key" to a given key. This value
is the part of the passed in key that differs from this key. There is
the following relation:
other = key.commonKey(other) + key.differenceKey(other)
for an arbitrary configuration key key.
Parameters: other - the key for which the difference is to be calculated the difference key
Checks if two ConfigurationKey objects are equal. The
method can be called with strings or other objects, too.
Parameters: c - the object to compare a flag if both objects are equal
Checks if this key is an attribute key.
a flag if this key is an attribute key
isAttributeKey
public static boolean isAttributeKey(String key)(Code)
Checks if the passed in key is an attribute key. Such attribute keys
start and end with certain marker strings. In some cases they must be
treated slightly different.
Parameters: key - the key (part) to be checked a flag if this key is an attribute key
Sets the new length of this configuration key. With this method it is
possible to truncate the key, e.g. to return to a state prior calling
some append() methods. The semantic is the same as
the setLength() method of StringBuffer.
Parameters: len - the new length of the key