Class JsonNullableJackson3Module
- All Implemented Interfaces:
tools.jackson.core.Versioned
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.JacksonModule
tools.jackson.databind.JacksonModule.SetupContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()mapBlankStringToNull(boolean state) Configures whether blank strings (for example""or" ") deserialized into aJsonNullableare mapped toJsonNullable.of(null)instead ofJsonNullable.undefined().voidsetupModule(tools.jackson.databind.JacksonModule.SetupContext context) tools.jackson.core.Versionversion()Methods inherited from class tools.jackson.databind.JacksonModule
getDependencies, getRegistrationId
-
Constructor Details
-
JsonNullableJackson3Module
public JsonNullableJackson3Module()
-
-
Method Details
-
mapBlankStringToNull
Configures whether blank strings (for example""or" ") deserialized into aJsonNullableare mapped toJsonNullable.of(null)instead ofJsonNullable.undefined().This matters for PATCH semantics: a blank string sent by a client expresses an explicit intent to clear the value, which
undefined()silently swallows.String-like targets (
String,CharSequenceand its implementations such asStringBuilder, andCharacter) are exempt: for those, a blank string is a legitimate value in its own right and is never diverted to this option. A deserializer the application has registered itself for the property's type is also exempt: it is given the blank string and decides the outcome, and this option does not override whatever that deserializer returns. In other words, the option only takes effect where the blank-string guard still runs, i.e. for non-string-like targets still handled by a deserializer Jackson itself ships. A converter declared with@JsonDeserialize(contentConverter = ...)on aJsonNullableproperty resolves to Jackson's ownStdConvertingDeserializerfor the wrapped value, so a blank string still takes the shortcut above and the converter is not invoked for it; unchanged from earlier versions. ADelegatingDeserializeran application registers around a type's deserializer, directly or via aValueDeserializerModifier, is classified by the innermost deserializer it ultimately wraps rather than by its own class. A deserializer that extends one of Jackson's own concrete deserializers (EnumDeserializer,BeanDeserializer,NumberDeserializers.NumberDeserializer, ...) keeps this shortcut, since it inherits Jackson's own blank-string handling; one that implements deserialization on Jackson's abstract bases (ValueDeserializer,StdDeserializer,StdScalarDeserializer, ...) receives the token instead; and a wrapper that does not extendDelegatingDeserializer(or does not overridegetDelegatee()) is classified by its own class rather than by what it wraps, so a wrapper should extendDelegatingDeserializerto be seen through.Default is
falsefor backwards compatibility.- Parameters:
state-trueto map blank strings toJsonNullable.of(null)- Returns:
- this module, for chaining
-
setupModule
public void setupModule(tools.jackson.databind.JacksonModule.SetupContext context) - Specified by:
setupModulein classtools.jackson.databind.JacksonModule
-
version
public tools.jackson.core.Version version()- Specified by:
versionin interfacetools.jackson.core.Versioned- Specified by:
versionin classtools.jackson.databind.JacksonModule
-
hashCode
public int hashCode() -
equals
-
getModuleName
- Specified by:
getModuleNamein classtools.jackson.databind.JacksonModule
-