if (bean != null) {
beanHolder = new ConstantBeanHolder(bean, routeContext.getCamelContext());
} else {
if (isCacheBean() && ObjectHelper.hasDefaultPublicNoArgConstructor(clazz)) {
// we can only cache if we can create an instance of the bean, and for that we need a public constructor
beanHolder = new ConstantTypeBeanHolder(clazz, routeContext.getCamelContext()).createCacheHolder();
} else {
if (ObjectHelper.hasDefaultPublicNoArgConstructor(clazz)) {
beanHolder = new ConstantTypeBeanHolder(clazz, routeContext.getCamelContext());
} else {
// this is only for invoking static methods on the bean
beanHolder = new ConstantStaticTypeBeanHolder(clazz, routeContext.getCamelContext());
}
}