Package org.apache.camel.model
Class BeanModelHelper
java.lang.Object
org.apache.camel.model.BeanModelHelper
Helper to create bean instances from bean model definitions.
Creating beans is complex as Camel support many options such as constructor, factory beans, builder beans, scripts,
and much more. This helper hides this complexity for creating bean instances.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
bind
(BeanFactoryDefinition<?> def, org.apache.camel.RouteTemplateContext routeTemplateContext) Creates and binds the bean to the route-template repository (local beans for kamelets).static Object
newInstance
(BeanFactoryDefinition def, org.apache.camel.CamelContext context) Creates a new bean.
-
Method Details
-
newInstance
public static Object newInstance(BeanFactoryDefinition def, org.apache.camel.CamelContext context) throws Exception Creates a new bean.- Parameters:
def
- the bean modelcontext
- the camel context- Returns:
- the created bean instance
- Throws:
Exception
- is thrown if error creating the bean
-
bind
public static void bind(BeanFactoryDefinition<?> def, org.apache.camel.RouteTemplateContext routeTemplateContext) throws Exception Creates and binds the bean to the route-template repository (local beans for kamelets).- Parameters:
def
- the bean factory to bind.routeTemplateContext
- the context into which the bean factory should be bound.- Throws:
Exception
- if an error occurs while trying to bind the bean factory
-