public class StringMessageConverter extends AbstractMessageConverter
MessageConverter
that supports MIME type "text/plain" with the
payload converted to and from a String.logger
Constructor and Description |
---|
StringMessageConverter() |
StringMessageConverter(Charset defaultCharset) |
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 boolean |
supports(Class<?> clazz)
Whether the given class is supported by this converter.
|
addSupportedMimeTypes, canConvertFrom, canConvertTo, fromMessage, fromMessage, getContentTypeResolver, getDefaultContentType, getMimeType, getSerializedPayloadClass, getSupportedMimeTypes, isStrictContentTypeMatch, setContentTypeResolver, setSerializedPayloadClass, setStrictContentTypeMatch, supportsMimeType, toMessage, toMessage
public StringMessageConverter()
public StringMessageConverter(Charset defaultCharset)
protected boolean supports(Class<?> clazz)
AbstractMessageConverter
supports
in class AbstractMessageConverter
clazz
- the class to test for supporttrue
if supported; false
otherwiseprotected 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