Open pjfanning opened 3 years ago
Marking tentatively as 3.0, but may be pulled into 2.x depending on progress of Creator introspection improved planned for 2.13.
Re-read the description and realized this is not something introspection re-write (which was completed for 2.18) would do -- there is specific constraint that only one Creator of each type (properties-based, delegating, special-single-well-known-type-constructor) can be selected. What is being asked here is, instead, ability to allow multiple alternatives of properties-based constructor to use, dynamically selecting based on existence of values. A bit like DEDUCTION-based subtype selection works.
And there are no plans to support that; so removed 3.x
label.
Is your feature request related to a problem? Please describe. https://github.com/FasterXML/jackson-databind/pull/3034 provides a test case with a class that has multiple constructors. Some of the constructors default the values that appear in the main constructor.
Any JSON that does not provide all the fields for the class needs to use one of the specialised constructors with the in-built defaulting.
Jackson currently chooses one constructor and does not iterate over the constructors to find the one that works best for a given input.
Describe the solution you'd like I guess there is an overhead to iterating over constructors for each input - so this behaviour would need to be configurable (annotations or mapper features).
Usage example https://github.com/FasterXML/jackson-databind/pull/3034 (will be closed to avoid noise but the example will still be visible).
Additional context Probably an edge case that may not really need to be supported.