Example usage for org.apache.commons.beanutils PropertyUtils setSimpleProperty

List of usage examples for org.apache.commons.beanutils PropertyUtils setSimpleProperty

Introduction

In this page you can find the example usage for org.apache.commons.beanutils PropertyUtils setSimpleProperty.

Prototype

public static void setSimpleProperty(Object bean, String name, Object value)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException 

Source Link

Document

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

For more details see PropertyUtilsBean.

Usage

From source file:see.properties.impl.BeanPropertyResolver.java

@Override
public void set(Object bean, PropertyAccess property, Object value) {
    try {/*w w  w . j  a  v  a  2 s  .c  o  m*/
        PropertyUtils.setSimpleProperty(bean, getPropertyName(property), value);
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

From source file:service.ExcelWorkSheetHandler.java

private void assignValue(Object targetObj, String cellReference, String value) {
    if (null == targetObj || StringUtils.isEmpty(cellReference) || StringUtils.isEmpty(value)) {
        return;/*from   w w w .  ja v  a  2 s  . c  om*/
    }
    String propertyName = this.cellMapping.get(cellReference);
    if (null == propertyName) {
        LOG.error("Cell mapping doesn't exists!");
    } else {
        try {
            PropertyUtils.setSimpleProperty(targetObj, propertyName, value);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(ExcelWorkSheetHandler.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InvocationTargetException ex) {
            Logger.getLogger(ExcelWorkSheetHandler.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NoSuchMethodException ex) {
            Logger.getLogger(ExcelWorkSheetHandler.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}