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(java.nio.charset.Charset defaultCharset) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
convertFromInternal(Message<?> message,
java.lang.Class<?> targetClass,
java.lang.Object conversionHint)
Convert the message payload from serialized form to an Object.
|
protected java.lang.Object |
convertToInternal(java.lang.Object payload,
MessageHeaders headers,
java.lang.Object conversionHint)
Convert the payload object to serialized form.
|
protected boolean |
supports(java.lang.Class<?> clazz)
Whether the given class is supported by this converter.
|
canConvertFrom, canConvertTo, fromMessage, fromMessage, getContentTypeResolver, getDefaultContentType, getMimeType, getSerializedPayloadClass, getSupportedMimeTypes, isStrictContentTypeMatch, setContentTypeResolver, setSerializedPayloadClass, setStrictContentTypeMatch, supportsMimeType, toMessage, toMessage
public StringMessageConverter()
public StringMessageConverter(java.nio.charset.Charset defaultCharset)
protected boolean supports(java.lang.Class<?> clazz)
AbstractMessageConverter
supports
in class AbstractMessageConverter
clazz
- the class to test for supporttrue
if supported; false
otherwiseprotected java.lang.Object convertFromInternal(Message<?> message, java.lang.Class<?> targetClass, @Nullable java.lang.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 java.lang.Object convertToInternal(java.lang.Object payload, @Nullable MessageHeaders headers, @Nullable java.lang.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