-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Allow BeanPropertyWriter Sub-classes to Override get()
(remove final
)
#3343
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
Comments
get()
(remove final
)
Making |
@stevenschlansker Do you think this change for 2.19.0 could help reduce code in Blackbird, as suggested? |
I don't plan to make any changes to blackbird currently, and the next revision from me would probably be for 3.0+ |
Yes, I think effect of Np with not changing, just thought I'd mention in case you did changes things in 2.x. |
Is your feature request related to a problem? Please describe.
In
BeanPropertyWriter
theget
method is final and a few of the serialization methods inline the call to get making it much more difficult to create sub-classes ofBeanPropertyWriter
that attempt to optimize the get operation. An example of this can be seen in the Blackbird module which requires the entireserializeAsField
method to be overloaded (https://github.com/FasterXML/jackson-modules-base/blob/2.14/blackbird/src/main/java/com/fasterxml/jackson/module/blackbird/ser/ObjectPropertyWriter.java#L45) which then enforces additional constraints that the overload needs to handle complete serialization.Describe the solution you'd like
I think it would be useful for sub-classes of
BeanPropertyWriter
to be able to override get functionality and allowBeanPropertyWriter
to handle serialization based on its configuration (if serialization isn't also overridden). This would allow for further enhancements to the Blackbird module where it could become a simple optimized value getter usingMethodHandle
based reflection and pass the retrieved back to theBeanPropertyWriter
. Overall, this would enable Blackbird to remove its restrictions on which types it is allowed to handle.Usage example
BeanPropertyWriter.java
Blackbird Optimized Getters
The text was updated successfully, but these errors were encountered: