-
-
Couldn't load subscription status.
- Fork 1.4k
DatatypeFeatures
As part of Jackson 2.14, a new set of datatype-specific configuration settings was added, as suggested in JSTEP-7.
The idea is to allow easier configuration of more granular settings that affect specific class of data types: both so that:
- Settings may be changed on per-call basis
- New settings can be added with relative ease in newer versions, with minimal additional plumbing needed.
Each new configuration type is an Enum that implements DatatypeFeature interface.
Configuration is handled using either ObjectMapper.Builder (for ObjectMapper defaults) or ObjectReader.with() (and related) methods:
ObjectMapper mapper = JsonMapper.builder()
.disable(JsonNodeFeature.READ_NULL_PROPERTIES)
.build();
ObjectReader r = mapper.readerFor(MyPojo.class)
.with(JsonNodeFeature.READ_NULL_PROPERTIES);Following DatatypeFeature Enums have been added so far (as of Jackson 2.15)
EnumFeature was added for Enum-specific configuration.
JsonNodeFeature was added for configuring handling of Tree Model (JsonNode values), mostly reading and writing.