You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.
All of the code for this actually resides in jackson-databind, as ordering is handled there, and CSV module has no power over handling, at least currently.
I may be wrong, but I thought that creator properties are indeed sorted before other properties (with exception of possible Type and Object Ids), unless there is explicit @JsonPropertyOrder.
However... actually, this may currently conflict with one CSV-specifity: defaulting to alphabetic ordering of properties. If so, this is what changes ordering.
And if so, it would perhaps make sense to allow feature or setting that changes behavior to use @JsonCreator indicated ordering, and only use alphabetic order for remainder of properties, if any.
This would need to go in 2.7, and not be default, to retain full backwards compatibility.
It could actually be a MapperFeature (generic to all formats) as I assume it would make sense for JSON, XML, YAML as well. It can not be SerializationFeature just because setting can not be dynamically change, as ordering is fixed once BeanSerializer is constructed (or, rather, it is fixed for a given JsonSerializer instance: new instances may be constructed, but existing one can not be modified).
Would something like jackson-module-parameter-names make more sense? It seems even cleaner given you can exclude the @JsonCreator and @JsonProperty fields on/in the constructor.
Agreed, parameter name information should come through use of existing module (whether it's still stand-alone with 2.8, or embedded, which might happen).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is it possible with Parameter Name support an @JsonCreator annotated constructor could be all that is needed to manage column order and header names?
This would save lots of duplicate and easy to mess up @JsonProperty code.
Users would be required to have their parameter names match their field/accessors names.
Current Code:
Leveraging @JsonCreator and Parameter Names
The text was updated successfully, but these errors were encountered: