/** * 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; {@link * DefaultConfigurationSerializer#serialize(Configuration)} lets the caller * handle exceptions. * * @param configuration Configuration instance to serialize * @return a non-null String representing the <code>Configuration</code>, * or an error message. * @since 12 March, 2003 */ public static String toString( final Configuration configuration ) { DefaultConfigurationSerializer ser = new DefaultConfigurationSerializer(); try { return ser.serialize( configuration ); } catch( Exception e ) { return e.getMessage(); } }
/** * Get a generated Configuration with interpolated variable values. * @return The Configuration passed in the constructor, with {variable} * tokens in attributes and element bodies replaced with values (if * specified), or <code>null</code>. */ public Configuration getConfiguration() throws SAXException, ConfigurationException { if (this.conf == null) return null; InterpolatingConfigurationHandler handler = new InterpolatingConfigurationHandler(this.vars, this.conf.getLocation()); DefaultConfigurationSerializer ser = new DefaultConfigurationSerializer(); ser.serialize(handler, this.conf); return handler.getConfiguration(); }