-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
In #1870 we were able to switch from creating custom builder deserializers using encapsulation to using inheritance. This greatly simplified our code and allowed it to move from com.fasterxml
into our package (since we no longer required access to package private methods). (Thank you!)
The next step in allowing builder deserializers to be customized would be to simplify their creation in BeanDeserializerBuilder.java#L442.
Our custom builder deserializer has a corresponding builder deserializer builder, but currently we need to override the entire buildBuilderBased
method in our class when all we want to change is the type of builder deserializer created. Since our builder deserializer is a subclass of BeanDeserializerBuilder
it has a constructor which accepts at least the same arguments as BeanDeserializerBuilder
.
For our use case at least, delegating the construction of BeanDeserializerBuilder
to a separate protected ("factory") method would decouple the logic in buildBuilderBased
from the type of builder deserializer created.
Further generalizations would be possible by registering the type of builder to be created although I am unclear on the ROI of such a change and how it fits architecturally with the project.
Let me know what you think! I can definitely submit a patch for the simple refactoring of BeanDeserializerBuilder
, but I'm curious if you have some insight into how to make this more flexible.
Jackson Version: 2.10.0