public class Jdk8Module
extends com.fasterxml.jackson.databind.Module
Modifier and Type | Field and Description |
---|---|
protected boolean |
_cfgReadAbsentAsNull
See
configureReadAbsentAsNull(boolean) for details of this configuration
setting. |
protected boolean |
_cfgWriteAbsentAsNull
Configuration setting that determines whether `Optional.empty()` is
considered "same as null" for serialization purposes; that is, to be
filtered same as nulls are.
|
static boolean |
DEFAULT_READ_ABSENT_AS_NULL |
Constructor and Description |
---|
Jdk8Module() |
Modifier and Type | Method and Description |
---|---|
Jdk8Module |
configureAbsentsAsNulls(boolean state)
Deprecated.
Since 2.13, no replacement, will be removed from Jackson 3.0
(when optional types will be part of core databind)
|
Jdk8Module |
configureReadAbsentAsNull(boolean state)
Method for configuring handling of "absent"
Optional
values; absent meaning case where no value is found to pass via
Creator method (constructor, factory method). |
boolean |
equals(Object o) |
String |
getModuleName() |
int |
hashCode() |
void |
setupModule(com.fasterxml.jackson.databind.Module.SetupContext context) |
com.fasterxml.jackson.core.Version |
version() |
public static final boolean DEFAULT_READ_ABSENT_AS_NULL
protected boolean _cfgWriteAbsentAsNull
Default value is `false` 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.
Note that in most cases it makes more sense to just use `NON_ABSENT` inclusion criteria for filtering out absent optionals; this setting is mostly useful for legacy use cases that predate version 2.6.
protected boolean _cfgReadAbsentAsNull
configureReadAbsentAsNull(boolean)
for details of this configuration
setting.public void setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
setupModule
in class com.fasterxml.jackson.databind.Module
public com.fasterxml.jackson.core.Version version()
version
in interface com.fasterxml.jackson.core.Versioned
version
in class com.fasterxml.jackson.databind.Module
@Deprecated public Jdk8Module configureAbsentsAsNulls(boolean state)
_cfgHandleAbsentAsNull
: enabling means that `Optional.empty()` 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 older versions
of other "optional" values (like Guava optionals), it can be set to 'true'. The
default is `false` for backwards compatibility.
Note that in most cases it makes more sense to just use `NON_ABSENT` inclusion criteria for filtering out absent optionals; this setting is mostly useful for legacy use cases that predate version 2.6.
public Jdk8Module configureReadAbsentAsNull(boolean state)
Optional
values; absent meaning case where no value is found to pass via
Creator method (constructor, factory method).
If enabled (set to true
) it will be deserialized as
null
; if disabled it will be read as "empty" Optional
(same as if encountering actual JSON null
value).
Default is false
for backwards compatibility (retains behavior
pre-2.14); for Jackson 3.0 default will likely be changed.
public String getModuleName()
getModuleName
in class com.fasterxml.jackson.databind.Module
Copyright © 2023 FasterXML. All rights reserved.