* @param targetClass the target class to convert the payload to
* @return the converted payload of the reply message (never {@code null})
*/
@SuppressWarnings("unchecked")
protected <T> T doConvert(Message<?> message, Class<T> targetClass) {
MessageConverter messageConverter = getMessageConverter();
T value = (T) messageConverter.fromMessage(message, targetClass);
if (value == null) {
throw new MessageConversionException(message, "Unable to convert payload [" + message.getPayload() +
"] to type [" + targetClass + "] using converter [" + messageConverter + "]");
}
return value;