Interface SmartMessageConverter
- All Superinterfaces:
- MessageConverter
- All Known Implementing Classes:
- AbstractJsonMessageConverter,- AbstractMessageConverter,- ByteArrayMessageConverter,- CompositeMessageConverter,- GsonMessageConverter,- JsonbMessageConverter,- KotlinSerializationJsonMessageConverter,- MappingJackson2MessageConverter,- MarshallingMessageConverter,- ProtobufJsonFormatMessageConverter,- ProtobufMessageConverter,- StringMessageConverter
An extended 
MessageConverter SPI with conversion hint support.
 In case of a conversion hint being provided, the framework will call
 these extended methods if a converter implements this interface, instead
 of calling the regular fromMessage / toMessage variants.
- Since:
- 4.2.1
- Author:
- Juergen Hoeller
- 
Method SummaryModifier and TypeMethodDescriptionfromMessage(Message<?> message, Class<?> targetClass, Object conversionHint) A variant ofMessageConverter.fromMessage(Message, Class)which takes an extra conversion context as an argument, allowing to take e.g.Message<?>toMessage(Object payload, MessageHeaders headers, Object conversionHint) A variant ofMessageConverter.toMessage(Object, MessageHeaders)which takes an extra conversion context as an argument, allowing to take e.g.Methods inherited from interface org.springframework.messaging.converter.MessageConverterfromMessage, toMessage
- 
Method Details- 
fromMessage@Nullable Object fromMessage(Message<?> message, Class<?> targetClass, @Nullable Object conversionHint) A variant ofMessageConverter.fromMessage(Message, Class)which takes an extra conversion context as an argument, allowing to take e.g. annotations on a payload parameter into account.- 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
- See Also:
 
- 
toMessage@Nullable Message<?> toMessage(Object payload, @Nullable MessageHeaders headers, @Nullable Object conversionHint) A variant ofMessageConverter.toMessage(Object, MessageHeaders)which takes an extra conversion context as an argument, allowing to take e.g. annotations on a return type into account.- 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 new message, or nullif the converter does not support the Object type or the target media type
- See Also:
 
 
-