Skip to content

Commit

Permalink
Add Guava
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 30, 2016
1 parent 8cc669f commit 389dc9d
Show file tree
Hide file tree
Showing 66 changed files with 6,181 additions and 4 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Datatype modules to support 3rd party Collection libraries.

Currently included are:

* [Guava](guava/) datatype ([Guava](http://code.google.com/p/guava-libraries/))
* [HPPC](hppc/) datatype ([High-Performance Primitive Collections](https://labs.carrotsearch.com/hppc.html))
* [PCollections](pcollections/) datatype ([Persistent Java Collections](http://pcollections.org))

Expand All @@ -14,6 +15,19 @@ All modules are licensed under [Apache License 2.0](http://www.apache.org/licens

[![Build Status](https://travis-ci.org/FasterXML/jackson-datatypes-collections.svg)](https://travis-ci.org/FasterXML/jackson-datatypes-collections)

## More
## Usage

Like all standard Jackson modules (libraries that implement Module interface), registration for Collections
datatypes is done as follows:

```java
ObjectMapper mapper = new ObjectMapper()
.registerModule(new GuavaModule()
.registerModule(new HppcModule())
.registerModule(new PCollectionsModule())
;
```

after which datatype read/write support is available for all normal Jackson operations,
including support for nested types.

See [Wiki](../../wiki) for more information (javadocs).
58 changes: 58 additions & 0 deletions guava/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[Jackson](../../../jackson) datatype module (jar)
to support JSON serialization and deserialization of
[Guava](http://code.google.com/p/guava-libraries/) data types.

## Status

[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.datatype/jackson-datatype-guava/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.datatype/jackson-datatype-guava/)
[![Javadoc](https://javadoc-emblem.rhcloud.com/doc/com.fasterxml.jackson.datatype/jackson-datatype-guava/badge.svg)](http://www.javadoc.io/doc/com.fasterxml.jackson.datatype/jackson-datatype-guava)

Module has been production-ready since version 2.3.
Not all datatypes of Guava are support due to sheer size of the library; new support is added based on contributions.

## License

[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt)

## Usage

### Maven dependency

To use module on Maven-based projects, use following dependency:

```xml
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-guava</artifactId>
<version>2.7.3</version>
</dependency>
```

(or whatever version is most up-to-date at the moment)

### Registering module

Like all standard Jackson modules (libraries that implement Module interface), registration is done as follows:

```java
ObjectMapper mapper = new ObjectMapper()
.registerModule(new GuavaModule());
```

after which functionality is available for all normal Jackson operations.

### Configuration

Configurable settings of the module are:

* `configureAbsentsAsNulls` (default: true) (added in 2.6)
* If enabled, will consider `Optional.absent()` to be "null-equivalent", and NOT serialized if inclusion is defined as `Include.NON_NULL`
* If disabled, `Optional.absent()` behaves as standard referential type, and is included with `Include.NON_NULL`
* In either case, `Optional.absent()` values are always excluded with Inclusion values of:
* NON_EMPTY
* NON_ABSENT (new in Jackson 2.6)

## More

See [Wiki](../../wiki) for more information (javadocs, downloads).

82 changes: 82 additions & 0 deletions guava/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatypes-collections</artifactId>
<version>2.7.4-SNAPSHOT</version>
</parent>
<artifactId>jackson-datatype-guava</artifactId>
<name>Jackson datatype: Guava</name>
<packaging>bundle</packaging>
<description>Add-on datatype-support module for Jackson (https://github.com/FasterXML/jackson) that handles
Guava (http://code.google.com/p/guava-libraries/) types (currently mostly just collection ones)
</description>
<url>https://github.com/FasterXML/jackson-datatypes-collections</url>

<contributors>
<contributor>
<name>Steven Schlansker</name>
<email>[email protected]</email>
</contributor>
</contributors>

<properties>
<!-- 27-Nov-2015, tatu: For Jackson 2.7, move guava dep from 15 to 16 -->
<version.guava>16.0</version.guava>

<!-- 11-Sep-2015, tatu: As per [datatype-guava#80] -->
<version.guava.osgi>[${version.guava}.0,20)</version.guava.osgi>

<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>com/fasterxml/jackson/datatype/guava</packageVersion.dir>
<packageVersion.package>${project.groupId}.guava</packageVersion.package>
<!-- 28-Sep-2015, tatu: Export should work with defaults, but imports need
an override because we want wider range of versions for Guava
-->
<osgi.import>
com.google.common.*;version="${version.guava.osgi}",
*
</osgi.import>
</properties>

<dependencies>
<!-- Extends Jackson; supports Guava datatypes, so: -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${version.guava}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>process-packageVersion</id>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>com/fasterxml/jackson/**/failing/*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
33 changes: 33 additions & 0 deletions guava/release-notes/CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Here are people who have contributed to the development of Jackson JSON processor
Guava datatype component, version 2.x
(version numbers in brackets indicate release in which the problem was fixed)

Tatu Saloranta ([email protected]): author

Steven Schlansker ([email protected]): co-author

Stephan Schroevers: (Stephan202@github)
* Contributed #56: Add support `HashCode`
(2.5.0)
* Contributed #65: Add deserialization support for SortedMultiset and ImmutableSortedMultiset
(2.5.3)

Michael Hixson:
* Contributed fix for #67: Support deserializing ImmutableSetMultimaps
(2.6.0)

Alexey Kobyakov (akobiakov@github)
* Reported #64: `@JsonUnwrapped` annotation is ignored when a field is an Optional
(2.6.0)

Jose Thomas (josethomas@github)
* Contributed #52: Guava collection types do not allow null values
(2.6.2)

Jonathan Rodrigues de Oliveira (jorool@github)
* Contributed #79: New configuration for Guava Range default bound type.
(2.7.0)

Micahel Jameson (mjameson-se@github)
* Reported #87: OSGi import missing for `com.fasterxml.jackson.annotation.JsonInclude$Value`
(2.7.1)
Loading

0 comments on commit 389dc9d

Please sign in to comment.