Class StringMessageConverter
java.lang.Object
org.springframework.messaging.converter.AbstractMessageConverter
org.springframework.messaging.converter.StringMessageConverter
- All Implemented Interfaces:
- MessageConverter,- SmartMessageConverter
A 
MessageConverter that supports MIME type "text/plain" with the
 payload converted to and from a String.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields inherited from class org.springframework.messaging.converter.AbstractMessageConverterlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectconvertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) Convert the message payload from serialized form to an Object.protected ObjectconvertToInternal(Object payload, MessageHeaders headers, Object conversionHint) Convert the payload object to serialized form.protected booleanWhether the given class is supported by this converter.Methods inherited from class org.springframework.messaging.converter.AbstractMessageConverteraddSupportedMimeTypes, canConvertFrom, canConvertTo, fromMessage, fromMessage, getContentTypeResolver, getDefaultContentType, getMimeType, getSerializedPayloadClass, getSupportedMimeTypes, isStrictContentTypeMatch, setContentTypeResolver, setSerializedPayloadClass, setStrictContentTypeMatch, supportsMimeType, toMessage, toMessage
- 
Constructor Details- 
StringMessageConverterpublic StringMessageConverter()
- 
StringMessageConverter
 
- 
- 
Method Details- 
supportsDescription copied from class:AbstractMessageConverterWhether the given class is supported by this converter.- Specified by:
- supportsin class- AbstractMessageConverter
- Parameters:
- clazz- the class to test for support
- Returns:
- trueif supported;- falseotherwise
 
- 
convertFromInternalprotected Object convertFromInternal(Message<?> message, Class<?> targetClass, @Nullable Object conversionHint) Description copied from class:AbstractMessageConverterConvert the message payload from serialized form to an Object.- Overrides:
- convertFromInternalin class- AbstractMessageConverter
- Parameters:
- message- the input message
- targetClass- the target class for the conversion
- conversionHint- an extra object passed to the- MessageConverter, e.g. the associated- MethodParameter(may be- null}
- Returns:
- the result of the conversion, or nullif the converter cannot perform the conversion
 
- 
convertToInternal@Nullable protected Object convertToInternal(Object payload, @Nullable MessageHeaders headers, @Nullable Object conversionHint) Description copied from class:AbstractMessageConverterConvert the payload object to serialized form.- Overrides:
- convertToInternalin class- AbstractMessageConverter
- Parameters:
- payload- the Object to convert
- headers- optional headers for the message (may be- null)
- conversionHint- an extra object passed to the- MessageConverter, e.g. the associated- MethodParameter(may be- null}
- Returns:
- the resulting payload for the message, or nullif the converter cannot perform the conversion
 
 
-