Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Latest commit

 

History

History
58 lines (43 loc) · 1.75 KB

README.md

File metadata and controls

58 lines (43 loc) · 1.75 KB

⚠️ This project is no longer maintained.

gson-immutable

Build Status Coverage Status Maven GitHub license

Gson TypeAdapters for Guava Immutable Objects.

Requires JDK 1.6 or higher (Guava)

Javadoc

http://dampcake.github.io/gson-immutable

Usage

Maven

<dependency>
    <groupId>com.dampcake</groupId>
    <artifactId>gson-immutable</artifactId>
    <version>1.2</version>
</dependency>

Gradle

compile 'com.dampcake:gson-immutable:1.2'

Examples

Register Guava Immutable interfaces:

final Gson gson = new GsonBuilder().registerTypeAdapterFactory(ImmutableAdapterFactory.forGuava()).create();

Register Java interfaces:

final Gson gson = new GsonBuilder().registerTypeAdapterFactory(ImmutableAdapterFactory.forJava()).create();

Supported Types

Interface Immutable Version Supported?
Collection ImmutableCollection ✔️
List ImmutableList ✔️
Set ImmutableSet ✔️
SortedSet ImmutableSortedSet ✔️
NavigableSet ImmutableSortedSet ✔️
Map ImmutableMap ✔️
SortedMap ImmutableSortedMap ✔️