This is a multi-module umbrella project for various Jackson Datatype modules to support 3rd party Collection libraries.
Currently included are:
- Guava datatype (for Guava):
jackson-datatype-guava
- HPPC datatype (for High-Performance Primitive Collections):
jackson-datatype-hppc
- PCollections datatype (for Persistent Java Collections):
jackson-datatype-pcollections
- Eclipse Collections datatype (for Eclipse Collections):
jackson-datatype-eclipse-collections
(since 2.10)
All modules are licensed under Apache License 2.0.
To use these format backends Maven-based projects, use following dependency:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-[COLLECTION]</artifactId>
<version>2.9.5</version>
</dependency>
where COLLECTION
would be one of guava
, hppc
or pcollections
.
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).
Like all standard Jackson modules (libraries that implement Module interface), registration for Collections datatypes is done as follows:
ObjectMapper mapper = new ObjectMapper()
.registerModule(new GuavaModule())
.registerModule(new HppcModule())
.registerModule(new PCollectionsModule())
;
after which datatype read/write support is available for all normal Jackson operations, including support for nested types.
@Bean
public Jackson2ObjectMapperBuilderCustomizer customize()
{
return builder -> builder.modules( new GuavaModule() );
}