throw RuntimeMessages.MESSAGES.noTransformRegistryAvailable(_content.getClass().getName(), type.getName());
}
QName fromType = JavaTypes.toMessageType(_content.getClass());
QName toType = JavaTypes.toMessageType(type);
Transformer transformer = _transformerRegistry.getTransformer(fromType, toType);
if (transformer == null) {
throw RuntimeMessages.MESSAGES.noRegisteredTransformer(_content.getClass().getName(), type.getName(),
fromType.toString(), toType.toString());
}
Object transformedContent = transformer.transform(_content);
if (transformedContent == null) {
throw RuntimeMessages.MESSAGES.transformerReturnedNull(_content.getClass().getName(), type.getName(),
transformer.getClass().getName());
}
if (!type.isInstance(transformedContent)) {
throw RuntimeMessages.MESSAGES.transformerReturnedIncompatibleType(_content.getClass().getName(), type.getName(), transformer.getClass().getName(),
transformedContent.getClass().getName());
}
return type.cast(transformedContent);
}