public abstract class AbstractJsonMessageConverter extends AbstractMessageConverter
GsonMessageConverter
,
JsonbMessageConverter
,
fromJson(Reader, Type)
,
fromJson(String, Type)
,
toJson(Object, Type)
,
toJson(Object, Type, Writer)
logger
Modifier | Constructor and Description |
---|---|
protected |
AbstractJsonMessageConverter() |
Modifier and Type | Method and Description |
---|---|
protected Object |
convertFromInternal(Message<?> message,
Class<?> targetClass,
Object conversionHint)
Convert the message payload from serialized form to an Object.
|
protected Object |
convertToInternal(Object payload,
MessageHeaders headers,
Object conversionHint)
Convert the payload object to serialized form.
|
protected abstract Object |
fromJson(Reader reader,
Type resolvedType) |
protected abstract Object |
fromJson(String payload,
Type resolvedType) |
protected boolean |
supports(Class<?> clazz)
Whether the given class is supported by this converter.
|
protected abstract String |
toJson(Object payload,
Type resolvedType) |
protected abstract void |
toJson(Object payload,
Type resolvedType,
Writer writer) |
addSupportedMimeTypes, canConvertFrom, canConvertTo, fromMessage, fromMessage, getContentTypeResolver, getDefaultContentType, getMimeType, getSerializedPayloadClass, getSupportedMimeTypes, isStrictContentTypeMatch, setContentTypeResolver, setSerializedPayloadClass, setStrictContentTypeMatch, supportsMimeType, toMessage, toMessage
protected boolean supports(Class<?> clazz)
AbstractMessageConverter
supports
in class AbstractMessageConverter
clazz
- the class to test for supporttrue
if supported; false
otherwise@Nullable protected Object convertFromInternal(Message<?> message, Class<?> targetClass, @Nullable Object conversionHint)
AbstractMessageConverter
convertFromInternal
in class AbstractMessageConverter
message
- the input messagetargetClass
- the target class for the conversionconversionHint
- an extra object passed to the MessageConverter
,
e.g. the associated MethodParameter
(may be null
}null
if the converter cannot
perform the conversion@Nullable protected Object convertToInternal(Object payload, @Nullable MessageHeaders headers, @Nullable Object conversionHint)
AbstractMessageConverter
convertToInternal
in class AbstractMessageConverter
payload
- the Object to convertheaders
- optional headers for the message (may be null
)conversionHint
- an extra object passed to the MessageConverter
,
e.g. the associated MethodParameter
(may be null
}null
if the converter
cannot perform the conversion