Jackson 3.0.0-rc3
(another minor update)
Continuing quick pace of pre-release versions, Jackson 3.0.0-rc3 is out now, about 2 weeks after 3.0.0-rc2.
Highlights include:
- Finally fixed Gradle dependencies, metadata (I think!)
- Native JPMS support for 3 more modules —
jackson-module-kotlin
,jackson-datatype-javax-money
,jackson-datatype-moneta
— leavingjackson-module-scala
as the one and only 3.x Jackson module without JPMS frommodule-info.java
(and based on what I have read, it will remain so) - Embedding formerly separate Java 8 Date/Time module (
jackson-datatype-jsr310
) intojackson-databind
, similar to 2 previously merged Java 8 modules (jackson-datatype-jdk8
,jackson-module-parameter-names
).
all of which were planned as things to include next. One other expected feature — “Replace core Reflection use with MethodHandles
” — https://github.com/FasterXML/jackson-databind/pull/5046 — was initially merged but had to be reverted due to problems with datatype modules.
It will likely be included in 3.0.0-rc4
.
No More jackson-datatype-jsr310
as separate module
Of this these, the inclusion of Java 8 Date/Time module is probably the most significant change: you no longer have to (or can) register this module — support for java.time
types is built in jackson-databind
.
Date/Time configuration unification: new DateTimeFeature
After embedding jackson-datatype-jsr310
, a follow-up change was made to create new DateTimeFeature
to combine formerly separate configuration features from:
JavaTimeFeature
of Java 8 Date/Time module- Date/time related
DeserializationFeature
s (see databind#5067) - Date/time related
SerializationFeature
s (see databind#5066)
So now all basic on/off configuration for Date/Time value reading/writing will be configured using DateTimeFeature
:
// Can configure Mapper default settings
ObjectMapper mapper = JsonMapper.builder()
.enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
.build();
// as well as per-call settings via ObjectReader/ObjectWriter
String json = mapper.writer()
.with(DateTimeFeature.WRITE_DATES_WITH_CONTEXT_TIME_ZONE)
.writeValueAsString(LocalDateTime.now());
Enum read/write unification: fold into existing EnumFeature
Similar to changes wrt DateTimeFeature
, another refactoring was done for Enum configuration. EnumFeature
was added back in Jackson 2.14, but there were existing DeserializationFeature
s / SerializationFeature
s that cannot be moved in Jackson 2.x due to backwards-compatibility constraints.
For 3.0:
- Enum-related
DeserializationFeature
s (see databind#5079) - Enum-related
SerializationFeature
s (see databind#5080)
were folded into EnumFeature
so similarly all simple Enum reading/writing configuration will now use this separate configuration feature set:
// Can configure Mapper default settings
ObjectMapper mapper = JsonMapper.builder()
.enable(EnumFeature.WRITE_ENUMS_USING_TO_STRING)
.build();
// as well as per-call settings via ObjectReader/ObjectWriter
String json = mapper.writer()
.with(EnumFeature.WRITE_ENUMS_TO_LOWERCASE)
.writeValueAsString(MyEnum.FIRST);
Next Steps?
So the next thing will be 3.0.0-rc4 — planning for which is on-going.