import java.beans.PropertyDescriptor;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.beanutils.PropertyUtilsBean;
import org.apache.commons.lang3.StringUtils;
Map<String, Object> map = new HashMap<String, Object>();
try {
PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
PropertyDescriptor[] descriptors = propertyUtilsBean.getPropertyDescriptors(bean);
for (int i = 0; i < descriptors.length; i++) {
String name = descriptors[i].getName();
if (!StringUtils.equals(name, "class")) {
map.put(name, propertyUtilsBean.getNestedProperty(bean, name));
}
}
} catch (Exception e) {
e.printStackTrace();
}