mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复isXXX转换时的匹配问题
This commit is contained in:
@@ -114,17 +114,6 @@ public class MapToBeanCopier<T> extends AbsCopier<Map<?, ?>, T> {
|
||||
// 转驼峰尝试查找
|
||||
sKeyStr = StrUtil.toCamelCase(sKeyStr);
|
||||
propDesc = targetPropDescMap.get(sKeyStr);
|
||||
if(null != propDesc){
|
||||
return propDesc;
|
||||
}
|
||||
|
||||
// boolean类型参数名转换尝试查找
|
||||
if(sKeyStr.startsWith("is")){
|
||||
sKeyStr = StrUtil.removePreAndLowerFirst(sKeyStr, 2);
|
||||
propDesc = targetPropDescMap.get(sKeyStr);
|
||||
return propDesc;
|
||||
}
|
||||
|
||||
return null;
|
||||
return propDesc;
|
||||
}
|
||||
}
|
||||
|
@@ -248,8 +248,10 @@ public class BeanUtilTest {
|
||||
|
||||
final SubPersonWithAlias subPersonWithAlias = BeanUtil.toBean(map, SubPersonWithAlias.class);
|
||||
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
|
||||
|
Reference in New Issue
Block a user