public class JacksonResources extends Object
ObjectMapper allowing customization and
reuse across the application.| Modifier and Type | Field and Description |
|---|---|
static Function<ObjectMapper,ObjectMapper> |
HANDLE_UNKNOWN_PROPERTIES
A mapper of
ObjectMapper to handle unknown properties without throwing errors. |
static Function<ObjectMapper,ObjectMapper> |
INITIALIZER
A mapper of
ObjectMapper with all the required options for Discord4J operations. |
| Constructor and Description |
|---|
JacksonResources()
Deprecated.
use
create() |
JacksonResources(Function<ObjectMapper,ObjectMapper> mapper)
Deprecated.
use one of the static factories and then call
withMapperFunction(Function) |
JacksonResources(ObjectMapper objectMapper)
Deprecated.
use
createFromObjectMapper(ObjectMapper) instead, but consider all Discord4J-related
transformations are applied on the given ObjectMapper |
| Modifier and Type | Method and Description |
|---|---|
static JacksonResources |
create()
Create with a pre-configured
ObjectMapper for all Discord4J related operations. |
static JacksonResources |
createFromObjectMapper(ObjectMapper objectMapper)
Create based on
ObjectMapper applying on it all changes required for Discord4J related operations. |
ObjectMapper |
getObjectMapper()
Get the
ObjectMapper configured by this provider. |
JacksonResources |
withMapperFunction(Function<ObjectMapper,ObjectMapper> transformer)
Return a new
JacksonResources based on this current ObjectMapper but applying the given function. |
public static final Function<ObjectMapper,ObjectMapper> INITIALIZER
ObjectMapper with all the required options for Discord4J operations.public static final Function<ObjectMapper,ObjectMapper> HANDLE_UNKNOWN_PROPERTIES
ObjectMapper to handle unknown properties without throwing errors.@Deprecated public JacksonResources()
create()ObjectMapper that allows any field visibility,
registers modules to handle Discord4J specific mappings and ignores unknown properties.@Deprecated public JacksonResources(Function<ObjectMapper,ObjectMapper> mapper)
withMapperFunction(Function)ObjectMapper, based on the defaults given by JacksonResources().mapper - a Function to customize the ObjectMapper to be created@Deprecated public JacksonResources(ObjectMapper objectMapper)
createFromObjectMapper(ObjectMapper) instead, but consider all Discord4J-related
transformations are applied on the given ObjectMapperObjectMapper. Using this will replace the
recommended default and can lead to unexpected behavior and errors.objectMapper - a pre-configured ObjectMapper to usepublic static JacksonResources create()
ObjectMapper for all Discord4J related operations.public static JacksonResources createFromObjectMapper(ObjectMapper objectMapper)
ObjectMapper applying on it all changes required for Discord4J related operations.public JacksonResources withMapperFunction(Function<ObjectMapper,ObjectMapper> transformer)
JacksonResources based on this current ObjectMapper but applying the given function.transformer - a mapper to enrich the current ObjectMappertransformer appliedpublic ObjectMapper getObjectMapper()
ObjectMapper configured by this provider.