Class Jackson3MessageConverter
java.lang.Object
org.schlunzis.zis.stomp.client.Jackson3MessageConverter
- All Implemented Interfaces:
MessageConverter
A MessageConverter implementation that uses Jackson 3 to convert messages between JSON string representation and target object types.
The content type used by this converter is application/json;charset=UTF-8.
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new MessageConverter using a default Jackson 3 ObjectMapper.Jackson3MessageConverter(tools.jackson.databind.ObjectMapper mapper) Creates a new MessageConverter using the provided Jackson 3 ObjectMapper. -
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.
-
Constructor Details
-
Jackson3MessageConverter
public Jackson3MessageConverter()Creates a new MessageConverter using a default Jackson 3 ObjectMapper.- Since:
- 1.0.0
-
Jackson3MessageConverter
public Jackson3MessageConverter(tools.jackson.databind.ObjectMapper mapper) Creates a new MessageConverter using the provided Jackson 3 ObjectMapper.- Parameters:
mapper- the ObjectMapper to use for JSON serialization and deserialization- Since:
- 1.0.0
-
-
Method Details
-
convertToType
Description copied from interface:MessageConverterConverts the given message string to the specified target type.- Specified by:
convertToTypein interfaceMessageConverter- 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
-
convertToString
Description copied from interface:MessageConverterConverts the given object to its String representation.
The string must be UTF-8 encoded.
- Specified by:
convertToStringin interfaceMessageConverter- Parameters:
object- the object to convert- Returns:
- the String representation of the object
-
contentType
Description copied from interface:MessageConverterReturns 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.- Specified by:
contentTypein interfaceMessageConverter- Returns:
- the content type as a String
-