Example usage for org.apache.commons.configuration.beanutils XMLBeanDeclaration XMLBeanDeclaration

List of usage examples for org.apache.commons.configuration.beanutils XMLBeanDeclaration XMLBeanDeclaration

Introduction

In this page you can find the example usage for org.apache.commons.configuration.beanutils XMLBeanDeclaration XMLBeanDeclaration.

Prototype

public XMLBeanDeclaration(HierarchicalConfiguration config, String key, boolean optional) 

Source Link

Document

Creates a new instance of XMLBeanDeclaration and initializes it from the given configuration.

Usage

From source file:com.shanke.common.conf.CustomConfigurationBuilder.java

/**
 * Creates the resulting combined configuration. This method is called by
 * <code>getConfiguration()</code>. It checks whether the
 * <code>header</code> section of the configuration definition file contains
 * a <code>result</code> element. If this is the case, it will be used to
 * initialize the properties of the newly created configuration object.
 * //w  ww. j  a  v a 2s .c o m
 * @return the resulting configuration object
 * @throws ConfigurationException
 *             if an error occurs
 */
protected Configuration createResultConfiguration() throws ConfigurationException {
    XMLBeanDeclaration decl = new XMLBeanDeclaration(this, KEY_RESULT, true);
    Configuration result = Reflection.newInstance(Configuration.class);

    if (getMaxIndex(KEY_COMBINER) < 0) {
        // No combiner defined => set default
        result.setNodeCombiner(new OverrideCombiner());
    }

    return result;
}

From source file:org.ssh.comm.conf.CustomConfigurationBuilder.java

protected void configureEntityResolver() throws ConfigurationException {
    if (getMaxIndex(KEY_ENTITY_RESOLVER) == 0) {
        XMLBeanDeclaration decl = new XMLBeanDeclaration(this, KEY_ENTITY_RESOLVER, true);
        EntityResolver resolver = (EntityResolver) BeanHelper.createBean(decl, CatalogResolver.class);
        BeanHelper.setProperty(resolver, "fileSystem", getFileSystem());
        BeanHelper.setProperty(resolver, "baseDir", getBasePath());
        BeanHelper.setProperty(resolver, "substitutor", getSubstitutor());
        setEntityResolver(resolver);//from www. ja  v a  2s  .co m
    }
}