diff --git a/hutool-core/src/main/java/cn/hutool/core/bean/copier/MapToMapCopier.java b/hutool-core/src/main/java/cn/hutool/core/bean/copier/MapToMapCopier.java index e32eaf2e0..895a5f0be 100755 --- a/hutool-core/src/main/java/cn/hutool/core/bean/copier/MapToMapCopier.java +++ b/hutool-core/src/main/java/cn/hutool/core/bean/copier/MapToMapCopier.java @@ -48,10 +48,14 @@ public class MapToMapCopier extends AbsCopier { if (false == copyOptions.override && null != targetValue) { return; } + // 忽略空值 + if (false == copyOptions.ignoreNullValue && sValue == null) { + return; + } // 获取目标值真实类型并转换源值 final Type[] typeArguments = TypeUtil.getTypeArguments(this.targetType); - if(null != typeArguments){ + if (null != typeArguments) { //sValue = Convert.convertWithCheck(typeArguments[1], sValue, null, this.copyOptions.ignoreError); sValue = this.copyOptions.convertField(typeArguments[1], sValue); sValue = copyOptions.editFieldValue(sKeyStr, sValue);