org.apache.excalibur.configuration
Class ConfigurationUtil
java.lang.Object
org.apache.excalibur.configuration.ConfigurationUtil
- public class ConfigurationUtil
- extends java.lang.Object
General utility supporting static operations for generating string representations of a configuration suitable for debugging.
- Author:
| Method Summary |
static boolean |
equals(Configuration c1, Configuration c2)
Test to see if two Configuration's can be considered the same. |
static java.lang.String |
list(Configuration config)
Returns a simple string representation of the the supplied configuration. |
static void |
list(java.lang.StringBuffer buffer, java.lang.String lead, Configuration config)
populates a string buffer with an XML representation of a supplied configuration. |
static Configuration[] |
match(Configuration config, java.lang.String element, java.lang.String attribute)
Return all occurance of a configuration child containing the supplied attribute name. |
static Configuration[] |
match(Configuration config, java.lang.String element, java.lang.String attribute, java.lang.String value)
Return occurance of a configuration child containing the supplied attribute name and value. |
static Configuration |
matchFirstOccurance(Configuration config, java.lang.String element, java.lang.String attribute, java.lang.String value)
Return the first occurance of a configuration child containing the supplied attribute name and value or create a new empty configuration if no match found. |
static Configuration |
matchFirstOccurance(Configuration config, java.lang.String element, java.lang.String attribute, java.lang.String value, boolean create)
Return the first occurance of a configuration child containing the supplied attribute name and value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConfigurationUtil
public ConfigurationUtil()
list
public static java.lang.String list(Configuration config)
-
Returns a simple string representation of the the supplied configuration.
-
- Parameters:
config - a configuration
- Returns:
- a simplified text representation of a configuration suitable for debugging
list
public static void list(java.lang.StringBuffer buffer,
java.lang.String lead,
Configuration config)
-
populates a string buffer with an XML representation of a supplied configuration.
-
- Parameters:
buffer - the string buffer
lead - padding offset
config - a configuration
- Returns:
- a simplified text representation of a configuration suitable for debugging
match
public static Configuration[] match(Configuration config,
java.lang.String element,
java.lang.String attribute)
-
Return all occurance of a configuration child containing the supplied attribute name.
-
- Parameters:
config - the configuration
element - the name of child elements to select from the configuration
attribute - the attribute name to filter (null will match any attribute name)
- Returns:
- an array of configuration instances matching the query
match
public static Configuration[] match(Configuration config,
java.lang.String element,
java.lang.String attribute,
java.lang.String value)
-
Return occurance of a configuration child containing the supplied attribute name and value.
-
- Parameters:
config - the configuration
element - the name of child elements to select from the configuration
attribute - the attribute name to filter (null will match any attribute name )
value - the attribute value to match (null will match any attribute value)
- Returns:
- an array of configuration instances matching the query
matchFirstOccurance
public static Configuration matchFirstOccurance(Configuration config,
java.lang.String element,
java.lang.String attribute,
java.lang.String value)
-
Return the first occurance of a configuration child containing the supplied attribute name and value or create a new empty configuration if no match found.
-
- Parameters:
config - the configuration
element - the name of child elements to select from the configuration
attribute - the attribute name to filter
value - the attribute value to match (null will match any attribute value)
- Returns:
- a configuration instances matching the query or empty configuration
matchFirstOccurance
public static Configuration matchFirstOccurance(Configuration config,
java.lang.String element,
java.lang.String attribute,
java.lang.String value,
boolean create)
-
Return the first occurance of a configuration child containing the supplied attribute name and value. If the supplied creation policy if TRUE and no match is found, an empty configuration instance is returned, otherwise a null will returned.
-
- Parameters:
config - the configuration
element - the name of child elements to select from the configuration
attribute - the attribute name to filter
value - the attribute value to match (null will match any attribute value)
create - the creation policy if no match
- Returns:
- a configuration instances matching the query
equals
public static boolean equals(Configuration c1,
Configuration c2)
-
Test to see if two Configuration's can be considered the same. Name, value, attributes and children are test. The order of children is not taken into consideration for equality.
-
- Parameters:
c1 - Configuration to test
c2 - Configuration to test
- Returns:
- true if the configurations can be considered equals
Please see keelframework.org for information about new Keel releases.