-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
完善DateFormat配置优先级 #2706
完善DateFormat配置优先级 #2706
Conversation
760442b
to
c99628e
Compare
where a null format is passed to writeWithFormat()
c99628e
to
e61684f
Compare
Codecov Report
@@ Coverage Diff @@
## master #2706 +/- ##
============================================
- Coverage 80.12% 80.07% -0.06%
- Complexity 7141 7143 +2
============================================
Files 145 145
Lines 26964 27000 +36
Branches 6449 6458 +9
============================================
+ Hits 21605 21620 +15
- Misses 3497 3508 +11
- Partials 1862 1872 +10
Continue to review full report at Codecov.
|
应该是这个的优先级 |
我的理解是影响粒度越小优先级越高,toJSONStringWithDateFormat()只会影响调用函数的这一次转换的结果,所以优先级最高 |
@Omega-Ariston toJsonString 时传入了 时间格式的情况呢? toJsonString 传入时间格式时. 我想这个格式只应用到 没有加 |
fix issue #1868 #1968 #2029 #2452
正常的配置优先级应该是从小到大的,目前fastjson支持四种方式配置dateFormat,按照优先级从高到低分别为:
但是目前通过1和3方式配置的dateFormat存储到同一个变量里的,导致提升方式2的优先级时会同时覆盖1和3的优先级。所以用了不同的变量
fastJsonConfigDateFormatPattern
来存储方式3配置的dateFormat,并把与FastJsonConfig相关的setDateFormat方法统一到了这个变量上。另外为了避免冲突, 场景3中使用FastJsonConfig设置的dateFormat的一些方法进行了调整,并已全部通过测试。