mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-24 18:04:54 +08:00
remove methodsa
This commit is contained in:
parent
c0793d90bb
commit
c93d4785d9
@ -173,16 +173,6 @@ public class CopyOptions implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置忽略空值,当源对象的值为null时,忽略而不注入此值
|
||||
*
|
||||
* @return CopyOptions
|
||||
* @since 4.5.7
|
||||
*/
|
||||
public CopyOptions ignoreNullValue() {
|
||||
return setIgnoreNullValue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 属性过滤器,断言通过的属性才会被复制<br>
|
||||
* {@link BiPredicate#test(Object, Object)}返回{@code true}则属性通过,{@code false}不通过,抛弃之
|
||||
@ -237,16 +227,6 @@ public class CopyOptions implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置忽略字段的注入错误
|
||||
*
|
||||
* @return CopyOptions
|
||||
* @since 4.5.7
|
||||
*/
|
||||
public CopyOptions ignoreError() {
|
||||
return setIgnoreError(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否忽略字段的大小写
|
||||
*
|
||||
@ -258,16 +238,6 @@ public class CopyOptions implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置忽略字段的大小写
|
||||
*
|
||||
* @return CopyOptions
|
||||
* @since 4.5.7
|
||||
*/
|
||||
public CopyOptions ignoreCase() {
|
||||
return setIgnoreCase(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置拷贝属性的字段映射,用于不同的属性之前拷贝做对应表用<br>
|
||||
* 需要注意的是,当使用ValueProvider作为数据提供者时,这个映射是相反的,即fieldMapping中key为目标Bean的名称,而value是提供者中的key
|
||||
|
@ -411,7 +411,7 @@ public class BeanUtilTest {
|
||||
p2.setName("oldName");
|
||||
|
||||
// null值不覆盖目标属性
|
||||
BeanUtil.copyProperties(p1, p2, CopyOptions.of().ignoreNullValue());
|
||||
BeanUtil.copyProperties(p1, p2, CopyOptions.of().setIgnoreNullValue(true));
|
||||
assertEquals("oldName", p2.getName());
|
||||
|
||||
// null覆盖目标属性
|
||||
|
@ -30,7 +30,7 @@ public class BeanCopierTest {
|
||||
Assertions.assertNull(map.get("value"));
|
||||
|
||||
// 忽略null的情况下,空字段不写入map
|
||||
map = BeanCopier.of(a, new HashMap<>(), CopyOptions.of().ignoreNullValue()).copy();
|
||||
map = BeanCopier.of(a, new HashMap<>(), CopyOptions.of().setIgnoreNullValue(true)).copy();
|
||||
Assertions.assertFalse(map.containsKey("value"));
|
||||
Assertions.assertEquals(0, map.size());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user