package com.tofly.watermeter.custom.util;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.PropertyUtils;

import java.lang.reflect.InvocationTargetException;

/**
 * @author wujianjun
 * @date 2024/2/22 10:54
 */
public class NullAwareBeanUtilsBean extends BeanUtilsBean {
    @Override
    public void copyProperty(Object dest, String name, Object value) throws InvocationTargetException, IllegalAccessException {
        if (value == null) {
            // 如果源对象的属性值为 null，则不进行拷贝
            return;
        }
        super.copyProperty(dest, name, value);
    }
}