This commit is contained in:
Looly 2021-06-28 22:26:15 +08:00
parent 783cbf2ddb
commit 062d070d92
3 changed files with 14 additions and 20 deletions

View File

@ -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
-------------------------------------------------------------------------------------------------------------

View File

@ -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;
}

View File

@ -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;