MessageConverter implementation.
It customizes Jackson's default properties with the following ones:
MapperFeature#DEFAULT_VIEW_INCLUSION is disabledDeserializationFeature#FAIL_ON_UNKNOWN_PROPERTIES is disabled| Modifier and Type | Field and Description |
|---|---|
| private static final MimeType[] | |
| private ObjectMapper | |
| private Boolean |
| Access | Constructor and Description |
|---|---|
| public | MappingJackson2MessageConverter()
Construct a |
| public | MappingJackson2MessageConverter(MimeType...
the supported MIME types supportedMimeTypes)Construct a |
| public | MappingJackson2MessageConverter(ObjectMapper
the objectMapper)ObjectMapper to useConstruct a |
| public | MappingJackson2MessageConverter(ObjectMapper
the objectMapper, MimeType... ObjectMapper to usethe supported MIME types supportedMimeTypes)Construct a |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | canConvertFrom(Message<?> message, Class<?> targetClass)
Overrides org.
|
| protected boolean | canConvertTo(Object payload, MessageHeaders headers)
Overrides org.
|
| private void | |
| protected Object | convertFromInternal(Message<?>
the input message message, Class<?> the target class for the conversion targetClass, Object conversionHint)Overrides org. Convert the message payload from serialized form to an Object. |
| protected Object | convertToInternal(Object
the Object to convert payload, MessageHeaders optional headers for the message (may be headers, Object conversionHint)null)Overrides org. Convert the payload object to serialized form. |
| private Class | |
| protected JsonEncoding | Returns: the JSON encoding to use (nevernull)the MIME type from the MessageHeaders, if any contentType)Determine the JSON encoding to use for the given content type. |
| public ObjectMapper | |
| protected Class | Returns: the serialization view class, ornull if nonethe conversion hint Object as passed into the
converter for the current conversion attempt conversionHint)Determine a Jackson serialization view based on the given conversion hint. |
| protected void | logWarningIfNecessary(Type
the class that Jackson tested for (de-)serializability type, Throwable the Jackson-thrown exception to evaluate
(typically a cause)JsonMappingException)Determine whether to log the given exception coming from a
|
| public void | |
| public void | |
| protected boolean | supports(Class<?>
the class to test for support clazz)Implements abstract org. Whether the given class is supported by this converter. |
| DEFAULT_MIME_TYPES | back to summary |
|---|---|
| private static final MimeType[] DEFAULT_MIME_TYPES | |
| objectMapper | back to summary |
|---|---|
| private ObjectMapper objectMapper | |
| prettyPrint | back to summary |
|---|---|
| private Boolean prettyPrint
| |
| MappingJackson2MessageConverter | back to summary |
|---|---|
| public MappingJackson2MessageConverter() Construct a | |
| MappingJackson2MessageConverter | back to summary |
|---|---|
| public MappingJackson2MessageConverter(MimeType... supportedMimeTypes) Construct a
| |
| MappingJackson2MessageConverter | back to summary |
|---|---|
| public MappingJackson2MessageConverter(ObjectMapper objectMapper) Construct a
| |
| MappingJackson2MessageConverter | back to summary |
|---|---|
| public MappingJackson2MessageConverter(ObjectMapper objectMapper, MimeType... supportedMimeTypes) Construct a
| |
| canConvertFrom | back to summary |
|---|---|
| protected boolean canConvertFrom(Message<?> message, Class<?> targetClass) Overrides org.
| |
| canConvertTo | back to summary |
|---|---|
| protected boolean canConvertTo(Object payload, MessageHeaders headers) Overrides org.
| |
| configurePrettyPrint | back to summary |
|---|---|
| private void configurePrettyPrint() | |
| convertFromInternal | back to summary |
|---|---|
| protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) Overrides org. Doc from org. Convert the message payload from serialized form to an Object.
| |
| convertToInternal | back to summary |
|---|---|
| protected Object convertToInternal(Object payload, MessageHeaders headers, Object conversionHint) Overrides org. Doc from org. Convert the payload object to serialized form.
| |
| extractViewClass | back to summary |
|---|---|
| private Class | |
| getJsonEncoding | back to summary |
|---|---|
| protected JsonEncoding getJsonEncoding(MimeType contentType) Determine the JSON encoding to use for the given content type.
| |
| getObjectMapper | back to summary |
|---|---|
| public ObjectMapper getObjectMapper() Return the underlying | |
| getSerializationView | back to summary |
|---|---|
| protected Class Determine a Jackson serialization view based on the given conversion hint. | |
| logWarningIfNecessary | back to summary |
|---|---|
| protected void logWarningIfNecessary(Type type, Throwable cause) Determine whether to log the given exception coming from a
| |
| setObjectMapper | back to summary |
|---|---|
| public void setObjectMapper(ObjectMapper objectMapper) Set the If not set, a default Setting a custom-configured | |
| setPrettyPrint | back to summary |
|---|---|
| public void setPrettyPrint(boolean prettyPrint) Whether to use the This is a shortcut for setting up an ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); converter.setObjectMapper(mapper); | |
| supports | back to summary |
|---|---|
| protected boolean supports(Class<?> clazz) Implements abstract org. Doc from org. Whether the given class is supported by this converter. | |