/jackson-datatypes-collections

Jackson project that contains various collection-oriented datatype libraries: Guava, HPPC, PCollections

Primary LanguageJava

Overview

This is a multi-module umbrella project for various Jackson Datatype modules to support 3rd party Collection libraries.

Currently included are:

All modules are licensed under Apache License 2.0.

Status

Build Status

Usage

Maven dependencies

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).

Registration with ObjectMapper

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.

Usage with Spring Boot

@Bean
public Jackson2ObjectMapperBuilderCustomizer customize()
{
    return builder -> builder.modules( new GuavaModule() );
}