public class GuavaModule
extends com.fasterxml.jackson.databind.Module
Module that adds support for Guava types.
Current configurability includes:
configureAbsentsAsNulls (default: false):
Determines whether inclusion strategy of NON_NULL should additionally consider
Optional.absent() values (as POJO properties) to be excluded; if true, they will
be excluded, if false, they will be included.
Note that the defaults for other "Optional" types are different; Guava setting is chosen solely
for backwards compatibility.
| Modifier and Type | Field 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.
|
| Constructor and Description |
|---|
GuavaModule() |
| Modifier and Type | Method and Description |
|---|---|
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. |
boolean |
equals(Object o) |
String |
getModuleName() |
int |
hashCode() |
void |
setupModule(com.fasterxml.jackson.databind.Module.SetupContext context) |
com.fasterxml.jackson.core.Version |
version() |
protected boolean _cfgHandleAbsentAsNull
Default value is `true` for backwards compatibility (2.5 and prior only had this behavior).
Note that this setting MUST be changed BEFORE registering the module: changes after registration will have no effect.
public String getModuleName()
getModuleName in class com.fasterxml.jackson.databind.Modulepublic com.fasterxml.jackson.core.Version version()
version in interface com.fasterxml.jackson.core.Versionedversion in class com.fasterxml.jackson.databind.Modulepublic void setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
setupModule in class com.fasterxml.jackson.databind.Modulepublic GuavaModule configureAbsentsAsNulls(boolean state)
_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.Copyright © 2014-2016 FasterXML. All Rights Reserved.