xebia / jackson-lombok

Jackson extension to add support for the generated constructors of Project Lombok objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jackson Lombok

This repository contains extension for Jackson which allows better interoperability with Lombok classes.

The JacksonLombokAnnotationIntrospector allows Jackson to serialize and deserialize classes with constructors that are annotated with the java.beans.ConstructorProperties annotations. Lombok will automatically add this annotation to the constructors it generates.

This project is compatible with Jackson 2.4 - 2.6. Jackson 2.7 added support for ConstructorProperties which makes this project obsolete.

Usage

Add the JacksonLombokAnnotationIntrospector to the Jackson ObjectMapper in the following manner.

new ObjectMapper()
    .setAnnotationIntrospector(new JacksonLombokAnnotationIntrospector());

Now you can serialize and deserialize Lombok objects with generated constructors like the following class.

@Value
private static class ImmutablePojo {
    @JsonProperty("new_name")
    String name;
    @JsonProperty
    String string;
}

##Installation Add the following maven depency

<dependency>
    <groupId>com.xebia</groupId>
    <artifactId>jackson-lombok</artifactId>
    <version>1.1</version>
</dependency>

##Licence All files are provided under an MIT license.

About

Jackson extension to add support for the generated constructors of Project Lombok objects

License:MIT License


Languages

Language:Java 100.0%