Jackson datatype module for Javaslang
Java
Latest commit f4d7f5e Jan 20, 2017 @ruslansennov ruslansennov committed on GitHub Merge pull request #103 from ruslansennov/dev
MapLikeType #86
Permalink
Failed to load latest commit information.
.travis snapshots deployment Oct 29, 2015
src MapLikeType #86 Jan 19, 2017
.gitignore initial commit Oct 21, 2015
.travis.yml test minimal and latest jackson version Jan 17, 2017
LICENSE copying Nov 11, 2015
README.md Update README.md Dec 1, 2016
pom.xml set minimal jackson version to 2.7.2 Jan 17, 2017

README.md

Maven Central Build Status Coverage Status Gitter Chat

javaslang-jackson

Jackson datatype module for Javaslang library

Usage

Maven

<dependency>
  <groupId>io.javaslang</groupId>
  <artifactId>javaslang-jackson</artifactId>
  <version>2.1.0-alpha</version>
</dependency>

Gradle

compile("io.javaslang:javaslang-jackson:2.1.0-alpha")

Registering module

Just register a new instance of JavaslangModule

ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaslangModule());

Serialization/deserialization

String json = mapper.writer().writeValueAsString(List.of(List.of(1)));
// = [[1]]
Object restored1 = mapper.readValue(json, List.class);
// = List(java.util.ArrayList(1))
Object restored2 = mapper.readValue(json, new TypeReference<List<List<?>>>() {});
// = List(List(1))

Using Developer Versions

Developer versions can be found here.

Maven

<dependency>
  <groupId>io.javaslang</groupId>
  <artifactId>javaslang-jackson</artifactId>
  <version>2.1.0-SNAPSHOT</version>
</dependency>

Ensure that your ~/.m2/settings.xml contains the following:

<profiles>
    <profile>
        <id>allow-snapshots</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>snapshots-repo</id>
                <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                <releases>
                    <enabled>false</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>

Gradle

compile("io.javaslang:javaslang-jackson:2.1.0-SNAPSHOT")

Ensure that your build.gradle contains the following:

repositories {
    mavenCentral()
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
}