if (Message.class.isAssignableFrom(instanceClass)) {
try {
Method method = instanceClass.getMethod("getDefaultInstance", new Class[0]);
return (Message) method.invoke(null, new Object[0]);
} catch (Exception ex) {
throw new CamelException("Can't set the defaultInstance of ProtobufferDataFormat with "
+ className + ", caused by " + ex);
}
} else {
throw new CamelException("Can't set the defaultInstance of ProtobufferDataFormat with "
+ className + ", as the class is not a subClass of com.google.protobuf.Message");
}
}