Class GuavaModule
java.lang.Object
com.fasterxml.jackson.databind.Module
com.fasterxml.jackson.datatype.guava.GuavaModule
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned
public class GuavaModule
extends com.fasterxml.jackson.databind.Module
Basic Jackson
Module
that adds support for Guava types.
Current configurability includes:
configureAbsentsAsNulls
(default:false
): Determines whether inclusion strategy ofNON_NULL
should additionally considerOptional.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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.Module
com.fasterxml.jackson.databind.Module.SetupContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
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 com.google.common.collect.BoundType
private final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfigureAbsentsAsNulls
(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.defaultBoundType
(com.google.common.collect.BoundType boundType) Configuration method that may be used to change theBoundType
to be used when deserializingRange
objects.boolean
int
hashCode()
void
setupModule
(com.fasterxml.jackson.databind.Module.SetupContext context) com.fasterxml.jackson.core.Version
version()
Methods inherited from class com.fasterxml.jackson.databind.Module
getDependencies, getTypeId
-
Field Details
-
NAME
- See Also:
-
_cfgHandleAbsentAsNull
protected boolean _cfgHandleAbsentAsNullConfiguration 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 `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.
-
_defaultBoundType
protected com.google.common.collect.BoundType _defaultBoundType
-
-
Constructor Details
-
GuavaModule
public GuavaModule()
-
-
Method Details
-
getModuleName
- Specified by:
getModuleName
in classcom.fasterxml.jackson.databind.Module
-
version
public com.fasterxml.jackson.core.Version version()- Specified by:
version
in interfacecom.fasterxml.jackson.core.Versioned
- Specified by:
version
in classcom.fasterxml.jackson.databind.Module
-
setupModule
public void setupModule(com.fasterxml.jackson.databind.Module.SetupContext context) - Specified by:
setupModule
in classcom.fasterxml.jackson.databind.Module
-
configureAbsentsAsNulls
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:
- This module instance, useful for chaining calls
- Since:
- 2.6
-
defaultBoundType
Configuration method that may be used to change theBoundType
to be used when deserializingRange
objects. This configuration will is used when the object to be deserialized has no bound type attribute. The defaultBoundType
is CLOSED.- Parameters:
boundType
-BoundType
- Returns:
- This module instance, useful for chaining calls
- Since:
- 2.7
-
hashCode
public int hashCode() -
equals
-