Search in sources :

Example 1 with PropertyConfig

use of org.jboss.as.pojo.descriptor.PropertyConfig in project wildfly by wildfly.

the class BeanUtils method configure.

/**
     * Configure bean.
     *
     * @param beanConfig the bean metadata config, must not be null
     * @param beanInfo the bean info, can be null if enough info
     * @param module the current CL module, must not be null
     * @param bean the bean instance
     * @param nullify do we nullify property
     * @throws Throwable for any error
     */
public static void configure(BeanMetaDataConfig beanConfig, BeanInfo beanInfo, Module module, Object bean, boolean nullify) throws Throwable {
    Set<PropertyConfig> properties = beanConfig.getProperties();
    if (properties != null) {
        List<PropertyConfig> used = new ArrayList<PropertyConfig>();
        for (PropertyConfig pc : properties) {
            try {
                configure(beanInfo, module, bean, pc, nullify);
                used.add(pc);
            } catch (Throwable t) {
                if (nullify == false) {
                    for (PropertyConfig upc : used) {
                        try {
                            configure(beanInfo, module, bean, upc, true);
                        } catch (Throwable ignored) {
                        }
                    }
                    throw new StartException(t);
                }
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) PropertyConfig(org.jboss.as.pojo.descriptor.PropertyConfig) StartException(org.jboss.msc.service.StartException)

Aggregations

ArrayList (java.util.ArrayList)1 PropertyConfig (org.jboss.as.pojo.descriptor.PropertyConfig)1 StartException (org.jboss.msc.service.StartException)1