All Projects → FasterXML → Jackson Modules Java8

FasterXML / Jackson Modules Java8

Licence: apache-2.0
Set of support modules for Java 8 datatypes (Optionals, date/time) and features (parameter names)

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Jackson Modules Java8

Jackson Module Kotlin
Module that adds support for serialization/deserialization of Kotlin (http://kotlinlang.org) classes and data classes.
Stars: ✭ 830 (+166.03%)
Mutual labels:  hacktoberfest, jackson
Jackson Module Scala
Add-on module for Jackson (https://github.com/FasterXML/jackson) to support Scala-specific datatypes
Stars: ✭ 431 (+38.14%)
Mutual labels:  hacktoberfest, jackson
Jackson Dataformats Text
Uber-project for (some) standard Jackson textual format backends: csv, properties, yaml (xml to be added in future)
Stars: ✭ 258 (-17.31%)
Mutual labels:  hacktoberfest, jackson
Jackson
Main Portal page for the Jackson project
Stars: ✭ 7,066 (+2164.74%)
Mutual labels:  hacktoberfest, jackson
Jackson Jaxrs Providers
Multi-module project that contains Jackson-based JAX-RS providers for JSON, XML, YAML, Smile, CBOR formats
Stars: ✭ 98 (-68.59%)
Mutual labels:  hacktoberfest, jackson
Jackson Core
Core part of Jackson that defines Streaming API as well as basic shared abstractions
Stars: ✭ 2,003 (+541.99%)
Mutual labels:  hacktoberfest, jackson
Jackson Databind
General data-binding package for Jackson (2.x): works on streaming API (core) implementation(s)
Stars: ✭ 2,959 (+848.4%)
Mutual labels:  hacktoberfest, jackson
Autocomplete.js
Simple autocomplete pure vanilla Javascript library.
Stars: ✭ 3,428 (+998.72%)
Mutual labels:  hacktoberfest
Submitty
Homework Submission, Automated Grading, and TA grading system.
Stars: ✭ 311 (-0.32%)
Mutual labels:  hacktoberfest
Persistence
The Doctrine Persistence project is a library that provides common abstractions for object mapper persistence.
Stars: ✭ 3,481 (+1015.71%)
Mutual labels:  hacktoberfest
Start here
This repo outlines how to get started contributing to Operation Code, each of our projects, the language they are written in, and their purpose.
Stars: ✭ 307 (-1.6%)
Mutual labels:  hacktoberfest
Awesome Minimalist
A curated list of awesome minimalist frameworks (simple and lightweight).
Stars: ✭ 3,189 (+922.12%)
Mutual labels:  hacktoberfest
Overland Ios
📌 GPS logger for iOS devices
Stars: ✭ 310 (-0.64%)
Mutual labels:  hacktoberfest
Archiver
Easily create & extract archives, and compress & decompress files of various formats
Stars: ✭ 3,373 (+981.09%)
Mutual labels:  hacktoberfest
Scssphp
SCSS compiler written in PHP
Stars: ✭ 309 (-0.96%)
Mutual labels:  hacktoberfest
Spidermon
Scrapy Extension for monitoring spiders execution.
Stars: ✭ 309 (-0.96%)
Mutual labels:  hacktoberfest
Code Sleep Python
Awesome Projects in Python - Machine Learning Applications, Games, Desktop Applications all in Python 🐍
Stars: ✭ 306 (-1.92%)
Mutual labels:  hacktoberfest
Physx Rs
🎳 Rust binding and wrapper over NVIDIA PhysX 🦀
Stars: ✭ 310 (-0.64%)
Mutual labels:  hacktoberfest
Cucumber
A monorepo of common components - building blocks for implementing Cucumber in various languages.
Stars: ✭ 3,299 (+957.37%)
Mutual labels:  hacktoberfest
Esphome
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Stars: ✭ 4,324 (+1285.9%)
Mutual labels:  hacktoberfest

Overview

This is a multi-module umbrella project for Jackson modules needed to support Java 8 features, especially with Jackson 2.x that only requires Java 7 for running (and until 2.7 only Java 6).

Jackson 2.x

When used with Jackson 2.x, Java 8 support is provided via 3 separate modules:

  • Parameter names: support for detecting constructor and factory method ("creator") parameters without having to use @JsonProperty annotation
    • provides com.fasterxml.jackson.module.paramnames.ParameterNamesModule
  • Java 8 Date/time: support for Java 8 date/time types (specified in JSR-310 specification)
    • provides com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
    • ALSO provides legacy variant com.fasterxml.jackson.datatype.jsr310.JSR310TimeModule
    • difference between 2 modules is that of configuration defaults: use of JavaTimeModule strongly recommended for new code
  • Java 8 Datatypes: support for other new Java 8 datatypes outside of date/time: most notably Optional, OptionalLong, OptionalDouble
    • provides com.fasterxml.jackson.datatype.jdk8.Jdk8Module

all of which are built from this repository, and accessed and used as separate Jackson modules (with separate Maven artifacts).

Jackson 3.0

Jackson 3.0 changes things as it requires Java 8 to work and can thereby directly supported features.

Because of this parameter-names and datatypes modules are merged into jackson-databind and need not be registered; datetime module (JavaTimeModule) remains separate module due to its size and configurability options.

So you will only need to separately add "Java 8 Date/time" module (see above for description)

License

All modules are licensed under Apache License 2.0.

Status

Build Status Tidelift

Usage

Maven dependencies

To include modules, you use some or all of:

<dependency>
    <groupId>com.fasterxml.jackson.module</groupId>
    <artifactId>jackson-module-parameter-names</artifactId>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jdk8</artifactId>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jsr310</artifactId>
</dependency>

and either include versions directly, OR, preferably, import Jackson BOM that will specify consistent version set.

Note that the parent project -- jackson-modules-java8 -- is ONLY used as parent pom by individual "child" modules, and DOES NOT have dependencies on them. This means that you should not depend on it as that will not include child modules.

Registering modules

The most common mechanism (and one recommended by Jackson team) is to explicitly register modules you want. This is done by code like:

// Up to Jackson 2.9: (but not with 3.0)
ObjectMapper mapper = new ObjectMapper()
   .registerModule(new ParameterNamesModule())
   .registerModule(new Jdk8Module())
   .registerModule(new JavaTimeModule()); // new module, NOT JSR310Module

// with 3.0 (or with 2.10 as alternative)
ObjectMapper mapper = JsonMapper.builder() // or different mapper for other format
   .addModule(new ParameterNamesModule())
   .addModule(new Jdk8Module())
   .addModule(new JavaTimeModule())
   // and possibly other configuration, modules, then:
   .build();

Alternatively, you can also auto-discover these modules with:

ObjectMapper mapper = new ObjectMapper();
mapper.findAndRegisterModules();

Regardless of registration mechanism, after registration all functionality is available for all normal Jackson operations.

Notes on Registration

But do note that you should only either explicit OR automatic registration: DO NOT combine explicit and auto-registration. If you use both, only one of registrations will have effect. And selection of which one varies by module and settings:

  • If MapperFeature.IGNORE_DUPLICATE_MODULE_REGISTRATIONS is defined, the FIRST registration succeeds, rest ignored
    • Duplicates are detected using id provided by Module.getTypeId(); duplicate-detection requires that Module provides same for all instances (true for Modules provided by this repo)
  • Otherwise all registrations are processed by the LAST one has effect as it has precedence over earlier registrations.

Also note that before Jackson 2.10, auto-registration would only register older JSR310Module, and not newer JavaTimeModule -- this is due to backwards compatibility. This was changed in Jackson 2.10.

If you want "the other" version of the module but also use auto-registration, make sure to register "other" module explicitly AFTER calling mapper.findAndRegisterModules(). Call after works because getTypeId() provided by modules differs so they are not considered duplicates.

Development

Maintainers

Following developers have committer access to this project.

  • Authors
    • Nick Williams ([email protected]) contributed Java 8 date/time module; still helps issues from time to time
    • Tatu Saloranta (@cowtowncoder) wrote the other 2 modules and maintains them for 2.x (in 3.0, integrated into core jackson-databind)
  • Maintainers:
    • Michael O'Keeffe ([email protected]) is the current maintainer of Java 8 date/time module

More

See Wiki for more information (javadocs).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].