jackson-core icon indicating copy to clipboard operation
jackson-core copied to clipboard

Separate `PrettyPrinter` / `Instantiatable` into instance/supplier

Open cowtowncoder opened this issue 6 years ago • 0 comments

As of Jackson 2.x, PrettyPrinter interface is overloaded with Instantiable "mix-in" -- so PrettyPrinter that is registered is either:

  1. Used as-is, if impl does not implement Instantiatable. This works for stateless implementations
  2. If Instantiatable implemented, createInstance() called -- instance configured is basically "blueprint"

This is confusing setup, a result of retrofitting to solve a problem after PrettyPrinter was in use.

But with Jackson 3.0 we could and probably should change this to just configure supplier (with help of Java 8 functional interfaces), when configuring factories. And if leaving method in generator, that can just take a configured/stateless PrettyPrinter instance.

cowtowncoder avatar Dec 12 '18 19:12 cowtowncoder