Top Description Fields Constructors Methods
tools.jackson.datatype.guava

public Class GuavaModule

extends JacksonModule
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
com.google.common.collect.BoundType, tools.jackson.core.Version, tools.jackson.databind.JacksonModule, tools.jackson.datatype.guava.ser.GuavaBeanSerializerModifier

Basic Jackson tools.jackson.databind.JacksonModule that adds support for Guava types.

Current configurability includes:

Field Summary

Modifier and TypeField and Description
protected boolean
_cfgHandleAbsentAsNull

Configuration setting that determines whether `Optional.absent()` is considered "same as null" for serialization purposes; that is, to be filtered same as nulls are.

protected BoundType
private final String
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public GuavaModule

Returns:

This module instance, useful for chaining calls
configureAbsentsAsNulls
(boolean state)

Configuration method that may be used to change configuration setting _cfgHandleAbsentAsNull: enabling means that `Optional.absent()` values are handled like Java nulls (wrt filtering on serialization); disabling that they are only treated as "empty" values, but not like native Java nulls.

public GuavaModule

Returns:

This module instance, useful for chaining calls
defaultBoundType
(BoundType boundType)

Configuration method that may be used to change the BoundType to be used when deserializing com.google.common.collect.Range objects.

public String
getModuleName()

Implements abstract tools.jackson.databind.JacksonModule.getModuleName.

Method that returns a display that can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them.

public void
setupModule(JacksonModule.SetupContext context)

Implements abstract tools.jackson.databind.JacksonModule.setupModule.

Method called by ObjectMapper when module is registered.

public Version
version()

Implements abstract tools.jackson.databind.JacksonModule.version.

Implements tools.jackson.core.Versioned.version.

Method that returns version of this module.

Inherited from tools.jackson.databind.JacksonModule:
getDependenciesgetRegistrationId

Field Detail

_cfgHandleAbsentAsNullback to summary
protected boolean _cfgHandleAbsentAsNull

Configuration setting that determines whether `Optional.absent()` is considered "same as null" for serialization purposes; that is, to be filtered same as nulls are. If enabled, absent values are treated like nulls; if disabled, they are not. In either case, absent values are always considered "empty".

Default value is `false` (NOTE: in 2.x it defaulted to `true`)

Note that this setting MUST be changed BEFORE registering the module: changes after registration will have no effect.

_defaultBoundTypeback to summary
protected BoundType _defaultBoundType
NAMEback to summary
private final String NAME
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

GuavaModuleback to summary
public GuavaModule()

Method Detail

configureAbsentsAsNullsback to summary
public GuavaModule configureAbsentsAsNulls(boolean state)

Configuration method that may be used to change configuration setting _cfgHandleAbsentAsNull: enabling means that `Optional.absent()` values are handled like Java nulls (wrt filtering on serialization); disabling that they are only treated as "empty" values, but not like native Java nulls. Recommended setting for this value is `false`, for compatibility with other "optional" values (like JDK 8 optionals); but the default is `true` for backwards compatibility.

Returns:GuavaModule

This module instance, useful for chaining calls

defaultBoundTypeback to summary
public GuavaModule defaultBoundType(BoundType boundType)

Configuration method that may be used to change the BoundType to be used when deserializing com.google.common.collect.Range objects. This configuration will is used when the object to be deserialized has no bound type attribute. The default BoundType is CLOSED.

Parameters
boundType:BoundType

BoundType

Returns:GuavaModule

This module instance, useful for chaining calls

getModuleNameback to summary
public String getModuleName()

Implements abstract tools.jackson.databind.JacksonModule.getModuleName.

Doc from tools.jackson.databind.JacksonModule.getModuleName.

Method that returns a display that can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them.

Annotations
@Override
setupModuleback to summary
public void setupModule(JacksonModule.SetupContext context)

Implements abstract tools.jackson.databind.JacksonModule.setupModule.

Doc from tools.jackson.databind.JacksonModule.setupModule.

Method called by ObjectMapper when module is registered. It is called to let module register functionality it provides, using callback methods passed-in context object exposes.

Annotations
@Override
versionback to summary
public Version version()

Implements abstract tools.jackson.databind.JacksonModule.version.

Implements tools.jackson.core.Versioned.version.

Doc from tools.jackson.databind.JacksonModule.version.

Method that returns version of this module. Can be used by Jackson for informational purposes.

Annotations
@Override