mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix code
This commit is contained in:
parent
0c3a1ea298
commit
3c8236af95
@ -216,12 +216,12 @@ public class BeanCopier<T> implements Copier<T>, Serializable {
|
||||
}
|
||||
final HashSet<String> ignoreSet = (null != copyOptions.ignoreProperties) ? CollUtil.newHashSet(copyOptions.ignoreProperties) : null;
|
||||
|
||||
// 遍历目标bean的所有属性
|
||||
BeanUtil.descForEach(actualEditable, (prop)->{
|
||||
if(false == prop.isWritable(this.copyOptions.isTransientSupport())){
|
||||
// 字段不可写,跳过之
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查属性名
|
||||
String fieldName = prop.getFieldName();
|
||||
if (CollUtil.contains(ignoreSet, fieldName)) {
|
||||
|
@ -48,7 +48,7 @@ public class BeanValueProvider implements ValueProvider<String> {
|
||||
final PropDesc sourcePd = getPropDesc(key, null);
|
||||
|
||||
// 字段描述不存在或忽略读的情况下,表示不存在
|
||||
return null != sourcePd && false == sourcePd.isReadable(false);
|
||||
return null != sourcePd && sourcePd.isReadable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,6 @@ import cn.hutool.core.annotation.Alias;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.bean.copier.ValueProvider;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
@ -444,7 +443,7 @@ public class BeanUtilTest {
|
||||
public void setPropertiesTest(){
|
||||
Map<String, Object> resultMap = MapUtil.newHashMap();
|
||||
BeanUtil.setProperty(resultMap, "codeList[0].name", "张三");
|
||||
Console.log(resultMap);
|
||||
Assert.assertEquals("{codeList={0={name=张三}}}", resultMap.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cn.hutool.core.convert;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtilTest.SubPerson;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@ -62,7 +61,6 @@ public class ConvertToBeanTest {
|
||||
map1.put("key4", 4);
|
||||
|
||||
Map<String, String> map2 = Convert.toMap(String.class, String.class, map1);
|
||||
Console.log(map2);
|
||||
|
||||
Assert.assertEquals("1", map2.get("key1"));
|
||||
Assert.assertEquals("2", map2.get("key2"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user