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 】 修复CollUtil.subtract使用非标准Set等空指针问题(issue#I3XN1Z@Gitee)
|
||||||
* 【core 】 修复SqlFormatter部分SQL空指针问题(issue#I3XS44@Gitee)
|
* 【core 】 修复SqlFormatter部分SQL空指针问题(issue#I3XS44@Gitee)
|
||||||
* 【core 】 修复DateRange计算问题(issue#I3Y1US@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的忽略之
|
// 对key做映射,映射后为null的忽略之
|
||||||
// 这里 copyOptions.editFieldName() 不能少,否则导致 CopyOptions setFieldNameEditor 失效
|
// 这里 copyOptions.editFieldName() 不能少,否则导致 CopyOptions setFieldNameEditor 失效
|
||||||
String providerKey = copyOptions.editFieldName(copyOptions.getMappedFieldName(fieldName, false));
|
final String providerKey = copyOptions.editFieldName(copyOptions.getMappedFieldName(fieldName, false));
|
||||||
if(null == providerKey){
|
if(null == providerKey){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -538,6 +538,14 @@ public class BeanUtilTest {
|
|||||||
Assert.assertEquals(new Long(123456L), station2.getId());
|
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
|
@Test
|
||||||
public void copyListTest() {
|
public void copyListTest() {
|
||||||
Student student = new Student();
|
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
|
@Test
|
||||||
public void toMapTest() {
|
public void toMapTest() {
|
||||||
// 测试转map的时候返回key
|
// 测试转map的时候返回key
|
||||||
@ -650,8 +645,8 @@ public class BeanUtilTest {
|
|||||||
@Test
|
@Test
|
||||||
public void beanToBeanCopyOptionsTest() {
|
public void beanToBeanCopyOptionsTest() {
|
||||||
ChildVo1 childVo1 = new ChildVo1();
|
ChildVo1 childVo1 = new ChildVo1();
|
||||||
childVo1.setChild_address("中国北京天安门");
|
childVo1.setChild_address("中国北京五道口");
|
||||||
childVo1.setChild_name("张北京");
|
childVo1.setChild_name("张三");
|
||||||
childVo1.setChild_father_name("张无忌");
|
childVo1.setChild_father_name("张无忌");
|
||||||
childVo1.setChild_mother_name("赵敏敏");
|
childVo1.setChild_mother_name("赵敏敏");
|
||||||
|
|
||||||
@ -669,8 +664,7 @@ public class BeanUtilTest {
|
|||||||
Assert.assertEquals(childVo1.getChild_mother_name(), childVo2.getChildMotherName());
|
Assert.assertEquals(childVo1.getChild_mother_name(), childVo2.getChildMotherName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Data
|
||||||
@Setter
|
|
||||||
public static class ChildVo1 {
|
public static class ChildVo1 {
|
||||||
String child_name;
|
String child_name;
|
||||||
String child_address;
|
String child_address;
|
||||||
@ -678,8 +672,7 @@ public class BeanUtilTest {
|
|||||||
String child_father_name;
|
String child_father_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Data
|
||||||
@Setter
|
|
||||||
public static class ChildVo2 {
|
public static class ChildVo2 {
|
||||||
String childName;
|
String childName;
|
||||||
String childAddress;
|
String childAddress;
|
||||||
|
Loading…
Reference in New Issue
Block a user