public class BeanUtils {
private static final String DEFAULT_HYPHEN = "-";
public static void copyProperties(Object source, Object target) {
org.springframework.beans.BeanUtils.copyProperties(source, target);
try {
copyPropertiesExtension(source, target);
} catch (Exception e) {
log.error("反射调用/访问方法异常", e);
throw new RuntimeException(e);
}
}
public static void copyPropertiesExtension(Object source, Object target) throws InvocationTargetException, IllegalAccessException {
Class<?> sourceClazz = source.getClass();
Field[] sourceFields = sourceClazz.getDeclaredFields();
Class