Example usage for org.apache.commons.beanutils PropertyUtilsBean setIndexedProperty

List of usage examples for org.apache.commons.beanutils PropertyUtilsBean setIndexedProperty

Introduction

In this page you can find the example usage for org.apache.commons.beanutils PropertyUtilsBean setIndexedProperty.

Prototype

public void setIndexedProperty(Object bean, String name, int index, Object value)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException 

Source Link

Document

Set the value of the specified indexed property of the specified bean, with no type conversions.

Usage

From source file:com.linkedin.databus.core.util.ConfigLoader.java

private void fillPropertyFromList(Object bean, String propName, List<?> values)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    PropertyUtilsBean propUtils = _beanUtilsBean.getPropertyUtils();
    int idx = 0;/*from w  w  w .  j  av  a 2 s .  c  om*/
    for (Object elem : values) {
        if (elem instanceof Map<?, ?>) {
            Object subBean = propUtils.getIndexedProperty(bean, propName, idx);
            fillBeanFromMap(subBean, (Map<?, ?>) elem);
        } else {
            propUtils.setIndexedProperty(bean, propName, idx, elem);
        }
        ++idx;
    }
}