Class GenericMessageConverter
java.lang.Object
org.springframework.messaging.converter.SimpleMessageConverter
org.springframework.messaging.converter.GenericMessageConverter
- All Implemented Interfaces:
- MessageConverter
An extension of the 
SimpleMessageConverter that uses a
 ConversionService to convert the payload of the message
 to the requested type.
 Return null if the conversion service cannot convert
 from the payload type to the requested type.
- Since:
- 4.1
- Author:
- Stephane Nicoll
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new instance with a defaultConversionService.GenericMessageConverter(ConversionService conversionService) Create a new instance with the givenConversionService.
- 
Method SummaryModifier and TypeMethodDescriptionfromMessage(Message<?> message, Class<?> targetClass) Convert the payload of aMessagefrom a serialized form to a typed Object of the specified target class.Methods inherited from class org.springframework.messaging.converter.SimpleMessageConvertertoMessage
- 
Constructor Details- 
GenericMessageConverterpublic GenericMessageConverter()Create a new instance with a defaultConversionService.
- 
GenericMessageConverterCreate a new instance with the givenConversionService.
 
- 
- 
Method Details- 
fromMessageDescription copied from interface:MessageConverterConvert the payload of aMessagefrom a serialized form to a typed Object of the specified target class. TheMessageHeaders.CONTENT_TYPEheader should indicate the MIME type to convert from.If the converter does not support the specified media type or cannot perform the conversion, it should return null.- Specified by:
- fromMessagein interface- MessageConverter
- Overrides:
- fromMessagein class- SimpleMessageConverter
- Parameters:
- message- the input message
- targetClass- the target class for the conversion
- Returns:
- the result of the conversion, or nullif the converter cannot perform the conversion
 
 
-