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(SubnodeConfiguration config, ConfigurationNode node) 

Source Link

Document

Creates a new instance of XMLBeanDeclaration and initializes it with the configuration node that contains the bean declaration.

Usage

From source file:nz.co.senanque.madura.configuration.MaduraConfiguration.java

public Object getProperty(String arg0) {
    Configuration config = m_configuration;
    if (config instanceof XMLConfiguration) {
        try {/*from  w  ww.j  ava  2 s  .  c  o  m*/
            BeanDeclaration decl = new XMLBeanDeclaration((XMLConfiguration) config, arg0);
            return BeanHelper.createBean(decl);
        } catch (IllegalArgumentException e) {
            return null;
        }
    } else {
        return config.getString(arg0);
    }
}

From source file:nz.co.senanque.madura.spring.ConfigProxyFactoryBean.java

public Object getObject() throws Exception {
    Configuration config = m_configuration.getConfiguration();
    if (config instanceof XMLConfiguration) {
        BeanDeclaration decl = new XMLBeanDeclaration((XMLConfiguration) config, getKey());
        Object o = decl.getBeanClassName();
        if (o == null) {
            String value = config.getString(getKey());
            return value;
        }// ww w  . j a  v a 2s.c  o m
        return BeanHelper.createBean(decl);
    } else {
        return config.getString(getKey());
    }
}

From source file:nz.co.senanque.madura.spring.ConfigProxyFactoryBean.java

public Class getObjectType() {
    if (m_configuration == null) {
        return null;
    }/* w  ww . j av a  2s . com*/
    Configuration config = m_configuration.getConfiguration();
    if (config instanceof XMLConfiguration) {
        try {
            BeanDeclaration decl = new XMLBeanDeclaration((XMLConfiguration) config, getKey());
            String n = decl.getBeanClassName();
            if (n == null) {
                return String.class;
            }
            return Class.forName(decl.getBeanClassName());
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    } else {
        return String.class;
    }
}