Skip to content

Major 3x Features

Tatu Saloranta edited this page Jun 1, 2024 · 5 revisions

NOTE: (as of March 2024) -- fallen behind; not updated since 2018


Here is a loose list of planned and implemented Major Features, Rewrites and Feature Areas for Jackson 3.x

Implemented Major Features

  • Immutable, Builder-based Entities (stream factories, object mapper)

Immutable Builder-based Entities

TokenStreamFactory (nee JsonFactory)

Former JsonFactory-- renamed as TokenStreamFactory -- and its format-specific subtypes are now created using Builders (subtype of TokenStreamFactory.TSFBuilder). Resulting factories are immutable, full thread-safe, and also JDK-serializable; as well as "re-buildable" meaning that a Builder can be created from a factory, to create differently configured variants.

Code example:

// TO BE WRITTEN

ObjectMapper

Similar to TokenStreamFactory, ObjectMapper instances are now built using format-specific subtype of MapperBuilder. Resulting mappers are immutable, full thread-safe, and also JDK-serializable; as well as "re-buildable" meaning that a Builder can be created from a factory, to create differently configured variants.

Code example:

// TO BE WRITTEN

Planned Major Features

  • Type categories for configuration overrides ("Scalars", "Collections", "POJOs", "Date/Time")
  • Required values, default values (possibly)

Type Categories (for config overrides)

Currently there are 3 main levels of configurability for properties (in decreasing priority/specificity order)

  1. Per-property overrides (via annotations)
  2. Per-type (class) default settings
  3. Global defaults

While this works, it does not allow covering some common use case like:

  • Always suppress serialization of all empty Collections (not having to annotate all properties, or set defaults for Collection, Set and specific POJO[] types)
  • Specify default Date/Time textual format for all Date/Time values
  • Always skip setting of null for all Container values (Collections, Maps, ...)

But it seems that we could introduce a new level between (2) and (3), wherein we could map basetype (Class) that (de)serializer declares to use, into one of bound set of "type categories". This set has to be hierarchic, and settings need to be merged. It is also important to create a reasonably stable set from 3.0 as changes would likely be disruptive.

This new value should be used in context of "config overrides", added in Jackson 2.8.

Required Values (and possibly default values)

Jackson 2.x allows specifying required status for properties, but only allows enforcing them for properties deserialized using Creators. It should be possible to extend this to other properties.

Related to this, it should be also possible to allow defaulting, probably by extending/generalizing facilities used as specifying default value as null replacement in 2.9.

Completed Major Rewrites

  • Properties discovery: start with full Creator discovery, THEN other properties based on that (2.18)

Planned Major Rewrites

  • Rewrite "unwrapped" handling: needed to support discovery of unknown properties (amongst other things)