接口 SmartMessageConverter
- 所有超级接口:
MessageConverter
- 所有已知实现类:
AbstractMessageConverter
,ByteArrayMessageConverter
,CompositeMessageConverter
,MappingJackson2MessageConverter
,MarshallingMessageConverter
,ProtobufJsonFormatMessageConverter
,ProtobufMessageConverter
,StringMessageConverter
public interface SmartMessageConverter extends MessageConverter
An extendedMessageConverter
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.- 从以下版本开始:
- 4.2.1
- 作者:
- Juergen Hoeller
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 Object
fromMessage(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. annotations on a payload parameter into account.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. annotations on a return type into account.从接口继承的方法 org.springframework.messaging.converter.MessageConverter
fromMessage, toMessage
方法详细资料
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.- 参数:
message
- the input messagetargetClass
- the target class for the conversionconversionHint
- an extra object passed to theMessageConverter
, e.g. the associatedMethodParameter
(may benull
}- 返回:
- the result of the conversion, or
null
if the converter cannot perform the conversion - 另请参阅:
MessageConverter.fromMessage(Message, Class)
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.- 参数:
payload
- the Object to convertheaders
- optional headers for the message (may benull
)conversionHint
- an extra object passed to theMessageConverter
, e.g. the associatedMethodParameter
(may benull
}- 返回:
- the new message, or
null
if the converter does not support the Object type or the target media type - 另请参阅:
MessageConverter.toMessage(Object, MessageHeaders)