public class DefaultConfigurationKey extends Object
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
Modifier and Type | Class and Description |
---|---|
class |
DefaultConfigurationKey.KeyIterator
A specialized iterator class for tokenizing a configuration key.
|
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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.
|
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 wrappedpublic 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 escapedpublic DefaultConfigurationKey append(String property)
property
- the name of the property to be addedpublic DefaultConfigurationKey appendIndex(int index)
index
- the index to be appendedpublic DefaultConfigurationKey appendAttribute(String attr)
attr
- the name of the attribute to be appendedpublic 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.public int hashCode()
public String toString()
public boolean isAttributeKey(String key)
key
- the key to be checkedpublic String constructAttributeKey(String key)
key
- the key to be decoratedpublic String attributeName(String key)
key
- the attribute keypublic String trimLeft(String key)
key
- the keypublic String trimRight(String key)
key
- the keypublic String trim(String key)
key
- the keypublic DefaultConfigurationKey.KeyIterator iterator()
Copyright © 2018 JBoss by Red Hat. All rights reserved.