Example usage for org.apache.commons.beanutils DynaBeanMapDecorator DynaBeanMapDecorator

List of usage examples for org.apache.commons.beanutils DynaBeanMapDecorator DynaBeanMapDecorator

Introduction

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

Prototype

public DynaBeanMapDecorator(DynaBean dynaBean, boolean readOnly) 

Source Link

Document

Construct a Map for the specified DynaBean .

Usage

From source file:com.xpfriend.fixture.cast.temp.MapFactory.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private Map toMap(Class<?> cls, DynaBean bean) throws IllegalAccessException, InvocationTargetException,
        NoSuchMethodException, InstantiationException {
    Map map = new DynaBeanMapDecorator(bean, false);
    if (cls.isAssignableFrom(map.getClass())) {
        return map;
    } else {//from w w w  .j a  v a2 s. co  m
        Map obj = (Map) newInstance(cls);
        obj.putAll(map);
        return obj;
    }
}