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

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

Introduction

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

Prototype

public Object getIndexedProperty(Object bean, String name, int index)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException 

Source Link

Document

Return 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  a  va  2s.  co m*/
    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;
    }
}