You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
where COLLECTION would be one of guava, hppc, pcollections, or eclipse-collections
(replace version with the latest available).
You may also use jackson-bom for defining
consistent sets of versions of various Jackson components.
NOTE! Parent pom itself only specifies defaults to individual modules but
DOES NOT include them, so you CAN NOT just add dependency to jackson-datatypes-collections.
Individual datatype modules need to be included explicitly (or via some other pom
that depends on them).
Registration with ObjectMapper
Like all standard Jackson modules (libraries that implement Module interface), registration for Collections
datatypes is done using one of 2 mechanisms:
ObjectMappermapper;
// New; 2.10.x / 3.0:mapper = JsonMapper.builder() // or mapper for other formats
.addModule(newGuavaModule())
.addModule(newHppcModule())
.addModule(newPCollectionsModule())
.build();
// Old (2.x), not available on 3.x:mapper = newObjectMapper() // or mapper for other formats
.registerModule(newGuavaModule())
.registerModule(newHppcModule())
.registerModule(newPCollectionsModule())
.registerModule(newEclipseCollectionsModule())
;
after which datatype read/write support is available for all normal Jackson operations,
including support for nested types.
Usage, per-datatype
See READMEs of individual modules for datatype-specific configuration, options
and so on: