-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MapperFeature.SET_PROPERTY_CREATOR_AS_DEFAULT
for handling single-arg constructor as property based
#1631
Comments
added SET_PROPERTY_CREATOR_AS_DEFAULT MapperFeature
MapperFeature.SET_PROPERTY_CREATOR_AS_DEFAULT
for handling single-arg constructor as property based
…lso renamed feature as `MapperFeature.CREATOR_MODE_DEFAULT_PROPERTIES`
Quick note: changed feature name to However: fundamentally patch as suggested is wrong. It does claim that a constructor or factory method has explicit indicator for use as Creator (equivalent of The problem I have in forcing discovery of creators is that:
and although users would only hit problems if enabling this feature, the feature itself would then be of questionable value. I am not 100% sure if there is value for feature as per my changes; it does allow slightly reducing boilerplate. Feature could also perhaps be used by parameter names module, or other functionality, even if they need to add complementary functionality. |
In my opinion if there's a case where you have to add annotations to support value types, then that's a big usability problem and it breaks Principle of least astonishment.
Can we limit this feature then to only public constructors? I would like to see exact scenarios where this feature, as was requested, would cause problems. |
@lpandzic The method in As to JDK types not having parameter names: is this really the case? Are JDK types not compiled with this information? I am not sure I would want to rely on that. I feel we are going round and round in circles again. I will remove the feature, and not consider any of this for 2.x. With 3.x there is need to rewrite introspection, and compatibility changes are acceptable for major revision. Exact logic will need a lot of work; but fundamentally whole POJO introspection will have to sort of start by considering Creators to use, as this will affect further determination of properties. As part of this phase it should be possible to both configure some aspects and to configure handlers. |
…itter's needs, and since this area will be heavily changed in 3.0, seems like bridge to nowhere.
Add a feature flag to change the default behavior of handling single-arg constructor as property based (to eliminate unnecessary @JsonCreator needed otherwise).
This is a continuation of #1498 but it should be done in backward compatible manner (flag should be disabled by default).
The text was updated successfully, but these errors were encountered: