// check for method exists
if (method != null) {
answer.setMethod(method);
// check there is a method with the given name, and leverage BeanInfo for that
BeanInfo beanInfo = beanHolder.getBeanInfo();
if (bean != null) {
// there is a bean instance, so check for any methods
if (!beanInfo.hasMethod(method)) {
throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method));
}
} else if (clazz != null) {
// there is no bean instance, so check for static methods only
if (!beanInfo.hasStaticMethod(method)) {
throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, clazz, method, true));
}
}
}