Add support for @ConstructorProperties
See original GitHub issueConstructorProperties provide a standard way to communicate constructor properties. Currently, you have to use JsonCreator
with JsonProperty
to achieve the same behavior with jackson.
Libraries like lombok generate constructors using the standard annotation, which makes it necessary to manually annotate the constructor when using jackson. There are already libraries that add support for this annotation but I believe it could be added to the main project without problems.
I believe ConstructorProperties is absent on android so it might be necessary to handle that gracefully.
Issue Analytics
- State:
- Created 8 years ago
- Comments:21 (11 by maintainers)
Top Results From Across the Web
Add support for @ConstructorProperties · Issue #905 - GitHub
There are already libraries that add support for this annotation but I believe it could be added to the main project without problems....
Read more >Don't understand @ConstructorProperties - Stack Overflow
So in the context of constructor properties, @ConstructorProperties({"someValue"}) means that the first parameter is associated with the getter ...
Read more >Little-known yet useful Java annotation: ConstructorProperties
If I give this code to a colleague who doesn't have knowledge about Jackson and I ask them to add support for XML...
Read more >[project lombok] @ConstructorProperties - Google Groups
add support for @ConstructorProperties to their compiler. I will post a comment on the GWT group to discuss this further. It would be...
Read more >@NoArgsConstructor, @RequiredArgsConstructor ...
Overview. This set of 3 annotations generate a constructor that will accept 1 parameter for certain fields, and simply assigns this parameter to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anyone else who stumbles upon this - as a result of this change, on upgrading to Jackson 2.7, trying to deserialize a class which is
@AllArgsConstructor
annotation, and@JsonCreator
I started having errors along the following lines:
This is because under the covers Lombok’s constructors use the
ConstructorProperties
annotation by default. The problem can be fixed by setting the following value.lombok.anyConstructor.suppressConstructorProperties = true
.Hope that’s useful…
Any MapperFeature to disable using of ConstructorProperties ? AUTO_DETECT_CREATORS seems not working. @cowtowncoder