FasterXML / FasterXML/jackson-databind
Add a feature to require "complete" creators; that is, to prevent use of setters if using property-based creator
- Ngôn ngữ chính
- Java
- Star
- 3.7k
- Fork
- 1.5k
- Merge trung bình
- 3 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 28
Mô tả
(note: migrated from https://github.com/FasterXML/jackson-core/issues/154 by @benson-basis)
---
I was surprised to learn that Jackson will combine `@JsonCreator` with patching properties. Even, in particular, protected final properties. When I wrote a mixin with `@JsonCreator`, I thought that I was specifying the one and only way (give or take other annotated constructors) to construct the class.
I wish that there was an option to set that would have this effect, and throw rather than patch a property if the `JsonCreator` is not usable in a deserialization.
---
My view of the semantics I want is
```
@JsonCreator(Complete = true)
```
If any `@JsonCreator` says this, then if Jackson feels a need to call a setter or patch a property, it should throw instead. For this to work, my other idea about JsonAnySetter versus JsonCreator has to be done, too.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.