Interface MessageConverter
- All Known Implementing Classes:
Jackson2MessageConverter, Jackson3MessageConverter, StringMessageConverter
public interface MessageConverter
Converts messages between String representation and target object types.
Implementations must be thread-safe, and it is recommended that they are stateless.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the content type associated with this message converter.convertToString(Object object) Converts the given object to its String representation.<T> TconvertToType(String messageStr, Class<T> targetType) Converts the given message string to the specified target type.
-
Method Details
-
convertToType
Converts the given message string to the specified target type.- Type Parameters:
T- the target type- Parameters:
messageStr- the message in String formattargetType- the desired target type class- Returns:
- the converted message object of the specified target type
- Throws:
ConversionException- if the conversion fails- Since:
- 1.0.0
-
convertToString
-
contentType
String contentType()Returns the content type associated with this message converter. This content type is used in STOMP message headers to indicate the format of the message body.
This is typically a MIME type, such as
text/plain;charset=UTF-8orapplication/json;charset=UTF-8.- Returns:
- the content type as a String
- Since:
- 1.0.0
-