Comments (6)
把isUserFollowing字段的get方法名改成isUserFollowing()就可以了,hutool的copy方法的get方法匹配is开头的布尔值字段时,是使用下面这几种格式匹配的
from hutool.
这个方法名称是使用IDEA自动生成的。 按照你的这个解决办法 我如果后面使用到了 boolean 类型 全都需要自己手动添加 get set 方法?
from hutool.
这个方法名称是使用IDEA自动生成的。按照你的这个解决办法 我如果后面使用到了 boolean 类型 全都需要自己手动添加 get set 方法?
首先,是不太建议使用is开头去命名布尔型变量,其次IDEA自动生成的get方法是可以调整模板的
from hutool.
这样的话,团队的所有人都去进行修改,为什么不按照流行的 spring
这类框架来进行拷贝呢? 是代码历史原因,还是出于什么原因呢?
from hutool.
这样的话,团队的所有人都去进行修改,为什么不按照流行的
spring
这类框架来进行拷贝呢? 是代码历史原因,还是出于什么原因呢?
主要是is开头的布尔型变量本身就是不太规范的写法,JSON 序列化也可能会出现问题
from hutool.
@iszhangsc 这里不匹配是因为Hutool存在一个字段和getter匹配检查的功能,这个Spring没有。
在Spring中,只读取getter和setter方法,而不去判断字段,你可以试下,isUserFollowing
换成任意名字,Spring也是照样可以的。
如果只判断方法而不去匹配字段,就存在误判问题。比如你自定义了一个方法,叫做getXXXX,但是并没有对应字段,那这个方法要不要读取呢?Hutool的策略是不读取。
Spring的方法存在第二个问题,就是假设你有两个字段:isUserFollowing
和userFollowing
那你的getter方法该如何定义呢?因此,为了解决这些问题,Hutool专门做了字段匹配功能,来避免这些问题。
欢迎进一步讨论。
from hutool.
Related Issues (20)
- FileUtil.createTempFile设置isReCreat为true HOT 1
- Assert.notEmpty java.lang.NoSuchMethodError: cn.hutool.core.lang.Assert.notEmpty HOT 4
- xls 文件解析异常 HOT 3
- hutool sm2生成的密钥与sm-crypto生成的密钥不一致,无法相互使用 HOT 1
- CglibUtil.copy 的 converter 参数无法使用 HOT 1
- hutool get/post 报错 HOT 4
- 在java 8 下面用hutool 5.8.29版本发送post请求调用google map的validateAddress api时发现返回404 HOT 2
- JWTUtil.createToken() 使用 HMAC-SHA256 签名时偶发 ArrayIndexOutOfBoundsException 异常 HOT 1
- JWTSignerUtil.createSigner 不支持传入hutool所定义算法Id HOT 1
- bug: 在jdk21 native编译下,jsonutil失效 HOT 1
- cn.hutool.core.collection.CollUtil.group(collection, hash)方法有歧义 HOT 1
- 6.0.0-M16,HttpUtils.post方法无法正确的发送json数据 HOT 1
- 请问6.0什么时候可正式发布呢? HOT 1
- log日志支不支持自动适配Android的日志 HOT 1
- 关于性能的问题 HOT 1
- CronUtil.schedule问题咨询 HOT 1
- FTP默认情况下没有启用被动模式导致上传文件失败 HOT 3
- 加密内容在其他在线解密网站有时可以解密有时不行 HOT 1
- 请问下有没有时长格式化工具? HOT 1
- UserAgentUtil.parse()无法正确解析出Win11操作系统参数 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hutool.