Skip to content
This repository has been archived by the owner on Jul 1, 2019. It is now read-only.
/ jackson-lombok Public archive

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

License

Notifications You must be signed in to change notification settings

xebia/jackson-lombok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.