jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Add a feature to require "complete" creators; that is, to prevent use of setters if using property-based creator

Open cowtowncoder opened this issue 9 years ago • 1 comments

(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.

cowtowncoder avatar Sep 30 '14 04:09 cowtowncoder