FasterXML / jackson-core

Core part of Jackson that defines Streaming API as well as basic shared abstractions
Apache License 2.0
2.25k stars 777 forks source link

Add new functional interface, `BufferRecycler.Gettable` to allow "bundling" instances with i/o classes #1193

Closed cowtowncoder closed 8 months ago

cowtowncoder commented 8 months ago

Looks like we need to add bit of coordination between jackson-databind ObjectMapper, ObjectReader, ObjectWriter, and matching streaming level readers/writers (JsonParser / JsonGenerator) so that they can share a single BufferRecycler. To untangle dependencies, let's introduce a new simple interface,Gettable` that can be implemented by input/output source/targets.

But initially we specifically need to retrofit just two:

cowtowncoder commented 8 months ago

@mariofusco Ok, I think this is the mechanism to pass BufferRecycler with SegmentedStringWriter / ByteArrayBuilder. Now need to figure out how JsonFactory (and other types) can optionally extract buffer recycler instead of allocating new one.