Module.SetupContext
Modifier and Type | Field and Description |
---|---|
protected boolean |
_cfgHandleAbsentAsNull
Configuration setting that determines whether `Optional.empty()` is
considered "same as null" for serialization purposes; that is, to be
filtered same as nulls are.
|
Constructor and Description |
---|
Jdk8Module() |
Modifier and Type | Method and Description |
---|---|
Jdk8Module |
configureAbsentsAsNulls(boolean state)
Configuration method that may be used to change configuration setting
_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. |
boolean |
equals(Object o) |
String |
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.
|
int |
hashCode() |
void |
setupModule(Module.SetupContext context)
Method called by
ObjectMapper when module is registered. |
Version |
version()
Method that returns version of this module.
|
getDependencies, getTypeId
protected boolean _cfgHandleAbsentAsNull
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.
public void setupModule(Module.SetupContext context)
Module
ObjectMapper
when module is registered.
It is called to let module register functionality it provides,
using callback methods passed-in context object exposes.setupModule
in class Module
public Version version()
Module
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 String getModuleName()
Module
getModuleName
in class Module
Copyright © 2020 JBoss by Red Hat. All rights reserved.