mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
修复isXXX转换时的匹配问题
This commit is contained in:
parent
fb3ea9a3cf
commit
fe7751342e
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# 5.8.13.M1 (2023-02-21)
|
# 5.8.13.M1 (2023-02-22)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
@ -15,6 +15,7 @@
|
|||||||
* 【core 】 修复ReUtil.delAll方法当 content 仅为空格时的问题(issue#I6GIMT@Gitee)
|
* 【core 】 修复ReUtil.delAll方法当 content 仅为空格时的问题(issue#I6GIMT@Gitee)
|
||||||
* 【core 】 修复Tailer文件内容跟随在调用stop后,文件依旧被占用问题(issue#I6GFD2@Gitee)
|
* 【core 】 修复Tailer文件内容跟随在调用stop后,文件依旧被占用问题(issue#I6GFD2@Gitee)
|
||||||
* 【core 】 修复ReflectUtil.invokeRaw方法中参数类型转换动作未生效的问题(pr#2912@Github)
|
* 【core 】 修复ReflectUtil.invokeRaw方法中参数类型转换动作未生效的问题(pr#2912@Github)
|
||||||
|
* 【core 】 修复isXXX转换时的匹配问题(issue#I6H0XF@Gitee)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -114,17 +114,6 @@ public class MapToBeanCopier<T> extends AbsCopier<Map<?, ?>, T> {
|
|||||||
// 转驼峰尝试查找
|
// 转驼峰尝试查找
|
||||||
sKeyStr = StrUtil.toCamelCase(sKeyStr);
|
sKeyStr = StrUtil.toCamelCase(sKeyStr);
|
||||||
propDesc = targetPropDescMap.get(sKeyStr);
|
propDesc = targetPropDescMap.get(sKeyStr);
|
||||||
if(null != propDesc){
|
return propDesc;
|
||||||
return propDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// boolean类型参数名转换尝试查找
|
|
||||||
if(sKeyStr.startsWith("is")){
|
|
||||||
sKeyStr = StrUtil.removePreAndLowerFirst(sKeyStr, 2);
|
|
||||||
propDesc = targetPropDescMap.get(sKeyStr);
|
|
||||||
return propDesc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,8 +248,10 @@ public class BeanUtilTest {
|
|||||||
|
|
||||||
final SubPersonWithAlias subPersonWithAlias = BeanUtil.toBean(map, SubPersonWithAlias.class);
|
final SubPersonWithAlias subPersonWithAlias = BeanUtil.toBean(map, SubPersonWithAlias.class);
|
||||||
Assert.assertEquals("sub名字", subPersonWithAlias.getSubName());
|
Assert.assertEquals("sub名字", subPersonWithAlias.getSubName());
|
||||||
Assert.assertTrue(subPersonWithAlias.isBooleana());
|
|
||||||
Assert.assertEquals(true, subPersonWithAlias.getBooleanb());
|
//https://gitee.com/dromara/hutool/issues/I6H0XF
|
||||||
|
Assert.assertFalse(subPersonWithAlias.isBooleana());
|
||||||
|
Assert.assertNull(subPersonWithAlias.getBooleanb());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.hutool.json;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class IssueI6H0XFTest {
|
||||||
|
@Test
|
||||||
|
public void toBeanTest(){
|
||||||
|
final Demo demo = JSONUtil.toBean("{\"biz\":\"A\",\"isBiz\":true}", Demo.class);
|
||||||
|
Assert.assertEquals("A", demo.getBiz());
|
||||||
|
Assert.assertEquals("{\"biz\":\"A\"}", JSONUtil.toJsonStr(demo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
static class Demo {
|
||||||
|
String biz;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user