}
if (type.isInstance(body)) {
return type.cast(body);
}
TransformerRegistry transformerRegistry = getTransformerRegistry();
if (transformerRegistry == null) {
throw BusMessages.MESSAGES.cannotConvertNoTransformRegistry(body.getClass().getName(), type.getName());
}
QName toType = JavaTypes.toMessageType(type);
QName fromType = JavaTypes.toMessageType(body.getClass());
Transformer transformer = transformerRegistry.getTransformer(fromType, toType);
if (transformer == null) {
T camelBody = super.getBody(type, body);
if (camelBody == null) {
throw BusMessages.MESSAGES.transformerMustBeRegistered(body.getClass().getName(), type.getName(), fromType.toString(), toType.toString());
}