Package org.apache.camel.model
Class BeanFactoryDefinition<P>
java.lang.Object
org.apache.camel.model.BeanFactoryDefinition<P>
- All Implemented Interfaces:
org.apache.camel.spi.ResourceAware
@Metadata(label="configuration")
public class BeanFactoryDefinition<P>
extends Object
implements org.apache.camel.spi.ResourceAware
Define custom beans that can be used in your Camel routes and in general.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCalls a method on a bean for creating the local beanCalls a method on a bean for creating the local beanTo set the type (fully qualified class name) to use for creating the bean.builderClass(String builderClass) Fully qualified class name of builder class to use for creating and configuring the bean.builderMethod(String builderMethod) Name of method when using builder class.constructor(Integer index, String value) Sets a constructor for creating the bean.constructors(Map<Integer, Object> constructors) Optional constructor arguments for creating the bean.destroyMethod(String destroyMethod) The name of the custom destroy method to invoke on bean shutdown, such as when Camel is shutting down.end()factoryBean(String factoryBean) Name of factory bean (bean id) to use for creating the bean.factoryMethod(String factoryMethod) Name of method to invoke when creating the bean via a factory bean.Class<?> org.apache.camel.RouteTemplateContext.BeanSupplier<Object> getName()org.apache.camel.spi.ResourcegetType()Calls a groovy script for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.initMethod(String initMethod) The name of the custom initialization method to invoke after setting bean properties.Calls java (Java source that is runtime compiled to Java bytecode) for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.Calls joor script (Java source that is runtime compiled to Java bytecode) for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.Calls a custom language for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.Calls a MvEL script for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.Calls a OGNL script for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.properties(Map<String, Object> properties) Sets properties to set on the created local beanSets a property to set on the created local beanvoidsetBeanSupplier(org.apache.camel.RouteTemplateContext.BeanSupplier<Object> beanSupplier) Bean supplier that uses lambda style to create the local beanvoidsetBeanType(Class<?> beanType) To set the type (fully qualified class name) to use for creating the bean.voidsetBuilderClass(String builderClass) Fully qualified class name of builder class to use for creating and configuring the bean.voidsetBuilderMethod(String builderMethod) Name of method when using builder class.voidsetConstructors(Map<Integer, Object> constructors) Optional constructor arguments for creating the bean.voidsetDestroyMethod(String destroyMethod) The name of the custom destroy method to invoke on bean shutdown, such as when Camel is shutting down.voidsetFactoryBean(String factoryBean) Name of factory bean (bean id) to use for creating the bean.voidsetFactoryMethod(String factoryMethod) Name of method to invoke when creating the bean via a factory bean.voidsetInitMethod(String initMethod) The name of the custom initialization method to invoke after setting bean properties.voidThe name of the bean (bean id)voidvoidsetProperties(Map<String, Object> properties) Optional properties to set on the created bean.voidsetResource(org.apache.camel.spi.Resource resource) voidThe script to execute that creates the bean when using scripting languages.voidsetScriptLanguage(String scriptLanguage) The script language to use when using inlined script for creating the bean, such as groovy, java, javascript etc.voidThe class name (fully qualified) of the beanWhat type to use for creating the bean.What type to use for creating the bean.Creates the bean from the given class typeCreates the bean from the given class type
-
Constructor Details
-
BeanFactoryDefinition
public BeanFactoryDefinition()
-
-
Method Details
-
setParent
-
setBeanType
To set the type (fully qualified class name) to use for creating the bean. -
getBeanClass
-
getBeanSupplier
-
setBeanSupplier
public void setBeanSupplier(org.apache.camel.RouteTemplateContext.BeanSupplier<Object> beanSupplier) Bean supplier that uses lambda style to create the local bean -
getName
-
setName
The name of the bean (bean id) -
getType
-
setType
The class name (fully qualified) of the bean -
getInitMethod
-
setInitMethod
The name of the custom initialization method to invoke after setting bean properties. The method must have no arguments, but may throw any exception. -
getDestroyMethod
-
setDestroyMethod
The name of the custom destroy method to invoke on bean shutdown, such as when Camel is shutting down. The method must have no arguments, but may throw any exception. -
getFactoryMethod
-
setFactoryMethod
Name of method to invoke when creating the bean via a factory bean. -
getFactoryBean
-
setFactoryBean
Name of factory bean (bean id) to use for creating the bean. -
getBuilderClass
-
setBuilderClass
Fully qualified class name of builder class to use for creating and configuring the bean. The builder will use the properties values to configure the bean. -
getBuilderMethod
-
setBuilderMethod
Name of method when using builder class. This method is invoked after configuring to create the actual bean. This method is often named build (used by default). -
getConstructors
-
setConstructors
Optional constructor arguments for creating the bean. Arguments correspond to specific index of the constructor argument list, starting from zero. -
getProperties
-
setProperties
Optional properties to set on the created bean. -
getScriptLanguage
-
setScriptLanguage
The script language to use when using inlined script for creating the bean, such as groovy, java, javascript etc. -
setScript
The script to execute that creates the bean when using scripting languages. If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource. -
getScript
-
type
What type to use for creating the bean. Can be one of: #class or #type #class or #type then the bean is created via the fully qualified classname, such as #class:com.foo.MyBean -
type
What type to use for creating the bean. Can be one of: #class or #type #class or #type then the bean is created via the fully qualified classname, such as #class:com.foo.MyBean -
typeClass
Creates the bean from the given class type- Parameters:
type- the type of the class to create as bean
-
typeClass
Creates the bean from the given class type- Parameters:
type- the type of the class to create as bean
-
beanType
To set the type (fully qualified class name) to use for creating the bean.- Parameters:
type- the fully qualified type of the returned bean
-
bean
Calls a method on a bean for creating the local bean- Parameters:
type- the bean class to call
-
bean
Calls a method on a bean for creating the local bean- Parameters:
type- the bean class to callmethod- the name of the method to call
-
initMethod
The name of the custom initialization method to invoke after setting bean properties. The method must have no arguments, but may throw any exception. -
destroyMethod
The name of the custom destroy method to invoke on bean shutdown, such as when Camel is shutting down. The method must have no arguments, but may throw any exception. -
factoryMethod
Name of method to invoke when creating the bean via a factory bean. -
factoryBean
Name of factory bean (bean id) to use for creating the bean. -
builderClass
Fully qualified class name of builder class to use for creating and configuring the bean. The builder will use the properties values to configure the bean. -
builderMethod
Name of method when using builder class. This method is invoked after configuring to create the actual bean. This method is often named build (used by default). -
groovy
Calls a groovy script for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.- Parameters:
script- the script
-
joor
Calls joor script (Java source that is runtime compiled to Java bytecode) for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.- Parameters:
script- the script
-
java
Calls java (Java source that is runtime compiled to Java bytecode) for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.- Parameters:
script- the script
-
language
Calls a custom language for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.- Parameters:
language- the languagescript- the script
-
mvel
Calls a MvEL script for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.- Parameters:
script- the script
-
ognl
Calls a OGNL script for creating the local bean If the script use the prefix resource: such as resource:classpath:com/foo/myscript.groovy, resource:file:/var/myscript.groovy, then its loaded from the external resource.- Parameters:
script- the script
-
constructor
Sets a constructor for creating the bean. Arguments correspond to specific index of the constructor argument list, starting from zero.- Parameters:
index- the constructor index (starting from zero)value- the constructor value
-
constructors
Optional constructor arguments for creating the bean. Arguments correspond to specific index of the constructor argument list, starting from zero. -
property
Sets a property to set on the created local bean- Parameters:
key- the property namevalue- the property value
-
properties
Sets properties to set on the created local bean -
end
-
getResource
public org.apache.camel.spi.Resource getResource()- Specified by:
getResourcein interfaceorg.apache.camel.spi.ResourceAware
-
setResource
public void setResource(org.apache.camel.spi.Resource resource) - Specified by:
setResourcein interfaceorg.apache.camel.spi.ResourceAware
-