public interface SmartMessageConverter extends MessageConverter
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.
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
fromMessage(Message<?> message,
java.lang.Class<?> targetClass,
java.lang.Object conversionHint)
A variant of
MessageConverter.fromMessage(Message, Class) which takes an extra
conversion context as an argument, allowing to take e.g. |
Message<?> |
toMessage(java.lang.Object payload,
MessageHeaders headers,
java.lang.Object conversionHint)
A variant of
MessageConverter.toMessage(Object, MessageHeaders) which takes an extra
conversion context as an argument, allowing to take e.g. |
fromMessage, toMessage
java.lang.Object fromMessage(Message<?> message, java.lang.Class<?> targetClass, java.lang.Object conversionHint)
MessageConverter.fromMessage(Message, Class)
which takes an extra
conversion context as an argument, allowing to take e.g. annotations
on a payload parameter into account.message
- the input messagetargetClass
- the target class for the conversionconversionHint
- an extra object passed to the MessageConverter
,
e.g. the associated MethodParameter
(may be null
}null
if the converter cannot
perform the conversionMessageConverter.fromMessage(Message, Class)
Message<?> toMessage(java.lang.Object payload, MessageHeaders headers, java.lang.Object conversionHint)
MessageConverter.toMessage(Object, MessageHeaders)
which takes an extra
conversion context as an argument, allowing to take e.g. annotations
on a return type into account.payload
- the Object to convertheaders
- optional headers for the message (may be null
)conversionHint
- an extra object passed to the MessageConverter
,
e.g. the associated MethodParameter
(may be null
}null
if the converter does not support the
Object type or the target media typeMessageConverter.toMessage(Object, MessageHeaders)