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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.Object
fromMessage(Message message)
Convert from a Message to a Java object.Message
toMessage(java.lang.Object object, MessageProperties messageProperties)
Convert a Java object to a Message.default Message
toMessage(java.lang.Object object, MessageProperties messageProperties, java.lang.reflect.Type genericType)
Convert a Java object to a Message.
-
-
-
Method Detail
-
toMessage
Message toMessage(java.lang.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(java.lang.Object object, MessageProperties messageProperties, @Nullable java.lang.reflect.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
java.lang.Object fromMessage(Message message) throws MessageConversionException
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
-
-