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 JacksonModule
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.
-
-
Field Summary
Fields Modifier and Type Field 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 com.google.common.collect.BoundType
_defaultBoundType
private java.lang.String
NAME
-
Constructor Summary
Constructors Constructor Description GuavaModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.GuavaModule
defaultBoundType(com.google.common.collect.BoundType boundType)
Configuration method that may be used to change theBoundType
to be used when deserializingRange
objects.boolean
equals(java.lang.Object o)
java.lang.String
getModuleName()
int
hashCode()
void
setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
com.fasterxml.jackson.core.Version
version()
-
-
-
Field Detail
-
NAME
private final java.lang.String NAME
- See Also:
- Constant Field Values
-
_cfgHandleAbsentAsNull
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 `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
-
-
Method Detail
-
getModuleName
public java.lang.String 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
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:
- This module instance, useful for chaining calls
- Since:
- 2.6
-
defaultBoundType
public GuavaModule defaultBoundType(com.google.common.collect.BoundType boundType)
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()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
-