-
Notifications
You must be signed in to change notification settings - Fork 3
Major 3x Features
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
- Immutable, Builder-based Entities (stream factories, object mapper)
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
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
- Type categories for configuration overrides ("Scalars", "Collections", "POJOs", "Date/Time")
- Required values, default values (possibly)
Currently there are 3 main levels of configurability for properties (in decreasing priority/specificity order)
- Per-property overrides (via annotations)
- Per-type (class) default settings
- Global defaults
While this works, it does not allow covering some common use case like:
- Always suppress serialization of all empty
Collection
s (not having to annotate all properties, or set defaults forCollection
,Set
and specificPOJO[]
types) - Specify default Date/Time textual format for all Date/Time values
- Always skip setting of
null
for all Container values (Collection
s,Map
s, ...)
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.
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.
- Properties discovery: start with full Creator discovery, THEN other properties based on that (2.18)
- Rewrite "unwrapped" handling: needed to support discovery of unknown properties (amongst other things)