Interface MessageConverter
- All Known Subinterfaces:
SmartMessageConverter
,StreamMessageConverter
- All Known Implementing Classes:
AbstractJackson2MessageConverter
,AbstractMessageConverter
,AllowedListDeserializingMessageConverter
,ContentTypeDelegatingMessageConverter
,DefaultStreamMessageConverter
,Jackson2JsonMessageConverter
,Jackson2XmlMessageConverter
,MarshallingMessageConverter
,MessagingMessageConverter
,MessagingMessageListenerAdapter.MessagingMessageConverterAdapter
,RemoteInvocationAwareMessageConverterAdapter
,SerializerMessageConverter
,SimpleMessageConverter
public interface MessageConverter
Message converter interface.
- Author:
- Mark Fisher, Mark Pollack, Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionfromMessage
(Message message) Convert from a Message to a Java object.toMessage
(Object object, MessageProperties messageProperties) Convert a Java object to a Message.default Message
toMessage
(Object object, MessageProperties messageProperties, Type genericType) Convert a Java object to a Message.
-
Method Details
-
toMessage
Message toMessage(Object object, MessageProperties messageProperties) throws MessageConversionException Convert a Java object to a Message.- Parameters:
object
- the object to convertmessageProperties
- The message properties.- Returns:
- the Message
- Throws:
MessageConversionException
- in case of conversion failure
-
toMessage
default Message toMessage(Object object, MessageProperties messageProperties, @Nullable Type genericType) throws MessageConversionException Convert a Java object to a Message. The default implementation callstoMessage(Object, MessageProperties)
.- Parameters:
object
- the object to convertmessageProperties
- The message properties.genericType
- the type to use to populate type headers.- Returns:
- the Message
- Throws:
MessageConversionException
- in case of conversion failure- Since:
- 2.1
-
fromMessage
Convert from a Message to a Java object.- Parameters:
message
- the message to convert- Returns:
- the converted Java object
- Throws:
MessageConversionException
- in case of conversion failure
-