Class ConfigurationUtil
- java.lang.Object
-
- org.apache.avalon.framework.configuration.ConfigurationUtil
-
public class ConfigurationUtil extends java.lang.ObjectThis class has a bunch of utility methods to work with configuration objects.- Since:
- 4.1.4
- Version:
- $Id: ConfigurationUtil.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
-
-
Constructor Summary
Constructors Modifier Constructor Description privateConfigurationUtil()Private constructor to block instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static booleanareAttributesEqual(org.apache.avalon.framework.configuration.Configuration c1, org.apache.avalon.framework.configuration.Configuration c2)Return true if the attributes of both configurations are equal.private static booleanareChildrenEqual(org.apache.avalon.framework.configuration.Configuration c1, org.apache.avalon.framework.configuration.Configuration c2)Return true if the children of both configurations are equal.private static booleanareValuesEqual(org.apache.avalon.framework.configuration.Configuration c1, org.apache.avalon.framework.configuration.Configuration c2)Return true if the values of two configurations are equal.private static org.w3c.dom.ElementcreateElement(org.w3c.dom.Document document, org.apache.avalon.framework.configuration.Configuration configuration)Create an DOMElementfrom aConfigurationobject.static booleanequals(org.apache.avalon.framework.configuration.Configuration c1, org.apache.avalon.framework.configuration.Configuration c2)Test to see if two Configuration's can be considered the same.private static booleanfindMatchingChild(org.apache.avalon.framework.configuration.Configuration c, java.util.ArrayList matchAgainst)Return true if find a matching child and remove child from list.static org.apache.avalon.framework.configuration.ConfigurationtoConfiguration(org.w3c.dom.Element element)Convert a DOM Element tree into a configuration tree.static org.w3c.dom.ElementtoElement(org.apache.avalon.framework.configuration.Configuration configuration)Convert a configuration tree into a DOM Element tree.static java.lang.StringtoString(org.apache.avalon.framework.configuration.Configuration configuration)Serialize the configuration object to a String.
-
-
-
Method Detail
-
toConfiguration
public static org.apache.avalon.framework.configuration.Configuration toConfiguration(org.w3c.dom.Element element)
Convert a DOM Element tree into a configuration tree.- Parameters:
element- the DOM Element- Returns:
- the configuration object
-
toElement
public static org.w3c.dom.Element toElement(org.apache.avalon.framework.configuration.Configuration configuration)
Convert a configuration tree into a DOM Element tree.- Parameters:
configuration- the configuration object- Returns:
- the DOM Element
-
toString
public static java.lang.String toString(org.apache.avalon.framework.configuration.Configuration configuration)
Serialize the configuration object to a String. If an exception occurs, the exception message will be returned instead. This method is intended to aid debugging;DefaultConfigurationSerializer.serialize(Configuration)lets the caller handle exceptions.- Parameters:
configuration- Configuration instance to serialize- Returns:
- a non-null String representing the
Configuration, or an error message. - Since:
- 12 March, 2003
-
equals
public static boolean equals(org.apache.avalon.framework.configuration.Configuration c1, org.apache.avalon.framework.configuration.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 testc2- Configuration to test- Returns:
- true if the configurations can be considered equals
-
areChildrenEqual
private static boolean areChildrenEqual(org.apache.avalon.framework.configuration.Configuration c1, org.apache.avalon.framework.configuration.Configuration c2)Return true if the children of both configurations are equal.- Parameters:
c1- configuration1c2- configuration2- Returns:
- true if the children of both configurations are equal.
-
findMatchingChild
private static boolean findMatchingChild(org.apache.avalon.framework.configuration.Configuration c, java.util.ArrayList matchAgainst)Return true if find a matching child and remove child from list.- Parameters:
c- the configurationmatchAgainst- the list of items to match against- Returns:
- true if the found.
-
areAttributesEqual
private static boolean areAttributesEqual(org.apache.avalon.framework.configuration.Configuration c1, org.apache.avalon.framework.configuration.Configuration c2)Return true if the attributes of both configurations are equal.- Parameters:
c1- configuration1c2- configuration2- Returns:
- true if the attributes of both configurations are equal.
-
areValuesEqual
private static boolean areValuesEqual(org.apache.avalon.framework.configuration.Configuration c1, org.apache.avalon.framework.configuration.Configuration c2)Return true if the values of two configurations are equal.- Parameters:
c1- configuration1c2- configuration2- Returns:
- true if the values of two configurations are equal.
-
createElement
private static org.w3c.dom.Element createElement(org.w3c.dom.Document document, org.apache.avalon.framework.configuration.Configuration configuration)Create an DOMElementfrom aConfigurationobject.- Parameters:
document- the DOM documentconfiguration- the configuration to convert- Returns:
- the DOM Element
-
-