Class JacksonCompat
java.lang.Object
org.springframework.vault.support.JacksonCompat
Internal compatibility facade for Jackson 2 and Jackson 3.
Detects the available Jackson generation at runtime and prefers Jackson 3 when both are present.
This class is intened for internal use only and will be removed in future versions.
- Since:
- 4.0
- Author:
- Mark Paluch
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAccessor forObjectMapperthat provides methods to serialize and deserialize JSON. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract AbstractHttpMessageConverter<Object>Create an HTTP message converter backed by the active Jackson generation.abstract ObjectResolve a JSON pointer path against a JSON tree node.Return the JSON tree model type used by the active Jackson generation.abstract JacksonCompat.ObjectMapperAccessorReturn the default JSON mapper accessor for the active Jackson generation.abstract @Nullable JacksonCompat.ObjectMapperAccessorgetObjectMapperAccessor(List<HttpMessageConverter<?>> messageConverters) Attempt to obtain anJacksonCompat.ObjectMapperAccessorfrom the given message converters.abstract JacksonCompat.ObjectMapperAccessorReturn a JSON mapper accessor configured for pretty-print output.static JacksonCompatinstance()Return the activeJacksonCompatstrategy for the current classpath.booleanReturn whether the active strategy is backed by Jackson 3.abstract voidregisterCodecs(Consumer<Object> messageConverters) Register JSON encoder and decoder codecs for the active Jackson generation.
-
Constructor Details
-
JacksonCompat
public JacksonCompat()
-
-
Method Details
-
instance
Return the activeJacksonCompatstrategy for the current classpath.- Returns:
- the active
JacksonCompatstrategy.
-
isJackson3
public boolean isJackson3()Return whether the active strategy is backed by Jackson 3.- Returns:
- true if Jackson 3 is active; false otherwise.
-
createHttpMessageConverter
Create an HTTP message converter backed by the active Jackson generation.- Returns:
- a configured HTTP message converter.
-
registerCodecs
Register JSON encoder and decoder codecs for the active Jackson generation.- Parameters:
messageConverters- a consumer receiving the codecs to register.
-
getJsonNodeClass
Return the JSON tree model type used by the active Jackson generation.- Returns:
- the active JSON node class.
-
getAt
Resolve a JSON pointer path against a JSON tree node.- Parameters:
jsonNode- the source JSON tree node.path- the JSON pointer expression.- Returns:
- the value located at the given path.
-
getObjectMapperAccessor
Return the default JSON mapper accessor for the active Jackson generation.- Returns:
- the default
JacksonCompat.ObjectMapperAccessor.
-
getPrettyPrintObjectMapperAccessor
Return a JSON mapper accessor configured for pretty-print output.- Returns:
- the pretty-print
JacksonCompat.ObjectMapperAccessor.
-
getObjectMapperAccessor
public abstract @Nullable JacksonCompat.ObjectMapperAccessor getObjectMapperAccessor(List<HttpMessageConverter<?>> messageConverters) Attempt to obtain anJacksonCompat.ObjectMapperAccessorfrom the given message converters.- Parameters:
messageConverters- the converters to inspect.- Returns:
- the matching
JacksonCompat.ObjectMapperAccessor, or null if none can be found.
-