import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.reflect.MethodUtils;
import java.beans.PropertyDescriptor;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
private static Map<String, Object> filedValueMap(Object object) {
final PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(object);
Map<String, Object> filedValueMap = Maps.newHashMap();
Arrays.asList(propertyDescriptors).forEach(property -> {
try {
filedValueMap.put(property.getName(), MethodUtils.invokeExactMethod(object, property.getReadMethod().getName()));
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
});
return filedValueMap;
}
















