mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-05 21:28:00 +08:00
fix bug
This commit is contained in:
parent
783cbf2ddb
commit
062d070d92
@ -23,6 +23,7 @@
|
||||
* 【core 】 修复CollUtil.subtract使用非标准Set等空指针问题(issue#I3XN1Z@Gitee)
|
||||
* 【core 】 修复SqlFormatter部分SQL空指针问题(issue#I3XS44@Gitee)
|
||||
* 【core 】 修复DateRange计算问题(issue#I3Y1US@Gitee)
|
||||
* 【core 】 修复BeanCopier中setFieldNameEditor失效问题(pr#349@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class BeanCopier<T> implements Copier<T>, Serializable {
|
||||
|
||||
// 对key做映射,映射后为null的忽略之
|
||||
// 这里 copyOptions.editFieldName() 不能少,否则导致 CopyOptions setFieldNameEditor 失效
|
||||
String providerKey = copyOptions.editFieldName(copyOptions.getMappedFieldName(fieldName, false));
|
||||
final String providerKey = copyOptions.editFieldName(copyOptions.getMappedFieldName(fieldName, false));
|
||||
if(null == providerKey){
|
||||
return;
|
||||
}
|
||||
|
@ -538,6 +538,14 @@ public class BeanUtilTest {
|
||||
Assert.assertEquals(new Long(123456L), station2.getId());
|
||||
}
|
||||
|
||||
static class Station extends Tree<Long> {}
|
||||
static class Tree<T> extends Entity<T> {}
|
||||
|
||||
@Data
|
||||
public static class Entity<T> {
|
||||
private T id;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyListTest() {
|
||||
Student student = new Student();
|
||||
@ -561,19 +569,6 @@ public class BeanUtilTest {
|
||||
|
||||
}
|
||||
|
||||
public static class Station extends Tree<Station, Long> {
|
||||
|
||||
}
|
||||
|
||||
public static class Tree<E, T> extends Entity<T> {
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Entity<T> {
|
||||
private T id;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toMapTest() {
|
||||
// 测试转map的时候返回key
|
||||
@ -650,8 +645,8 @@ public class BeanUtilTest {
|
||||
@Test
|
||||
public void beanToBeanCopyOptionsTest() {
|
||||
ChildVo1 childVo1 = new ChildVo1();
|
||||
childVo1.setChild_address("中国北京天安门");
|
||||
childVo1.setChild_name("张北京");
|
||||
childVo1.setChild_address("中国北京五道口");
|
||||
childVo1.setChild_name("张三");
|
||||
childVo1.setChild_father_name("张无忌");
|
||||
childVo1.setChild_mother_name("赵敏敏");
|
||||
|
||||
@ -669,8 +664,7 @@ public class BeanUtilTest {
|
||||
Assert.assertEquals(childVo1.getChild_mother_name(), childVo2.getChildMotherName());
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Data
|
||||
public static class ChildVo1 {
|
||||
String child_name;
|
||||
String child_address;
|
||||
@ -678,8 +672,7 @@ public class BeanUtilTest {
|
||||
String child_father_name;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Data
|
||||
public static class ChildVo2 {
|
||||
String childName;
|
||||
String childAddress;
|
||||
|
Loading…
Reference in New Issue
Block a user