Package org.apache.camel.model
Class BeanFactoryDefinition<T extends BeanFactoryDefinition<T,P>,P>
- java.lang.Object
-
- org.apache.camel.model.BeanFactoryDefinition<T,P>
-
- Type Parameters:
T
- the type of the bean factory.P
- the type of the parent node.
- Direct Known Subclasses:
RouteTemplateBeanDefinition
,TemplatedRouteBeanDefinition
@Metadata(label="configuration") public abstract class BeanFactoryDefinition<T extends BeanFactoryDefinition<T,P>,P> extends Object
Base class for nodes that define a bean factory.
-
-
Constructor Summary
Constructors Constructor Description BeanFactoryDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description P
bean(Class<?> type)
Calls a method on a bean for creating the local beanP
bean(Class<?> type, String method)
Calls a method on a bean for creating the local beanT
beanType(Class<?> type)
To set the return type of the script (fully qualified class name).T
beanType(String type)
To set the return type of the script (fully qualified class name).P
end()
Class<?>
getBeanClass()
org.apache.camel.RouteTemplateContext.BeanSupplier<Object>
getBeanSupplier()
String
getBeanType()
String
getName()
List<PropertyDefinition>
getProperties()
String
getScript()
String
getType()
P
groovy(String script)
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.P
joor(String script)
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.P
language(String language, String script)
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.P
mvel(String script)
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.P
ognl(String script)
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.T
properties(Map<String,String> properties)
Sets properties to set on the created local beanT
property(String key, String value)
Sets a property to set on the created local beanvoid
setBeanSupplier(org.apache.camel.RouteTemplateContext.BeanSupplier<Object> beanSupplier)
Bean supplier that uses lambda style to create the local beanvoid
setBeanType(Class<?> beanType)
To set the type (fully qualified class name) of the returned bean created by the script.void
setBeanType(String beanType)
To set the type (fully qualified class name) of the returned bean created by the script.void
setName(String name)
Bean namevoid
setProperties(List<PropertyDefinition> properties)
Optional properties to set on the created local beanvoid
setScript(String script)
The script to execute that creates the bean when using scripting languages.void
setType(String type)
What type to use for creating the bean.T
type(String type)
What type to use for creating the bean.T
type(String prefix, Class<?> type)
What type to use for creating the bean.T
typeClass(Class<?> type)
Creates the bean from the given class typeT
typeClass(String type)
Creates the bean from the given class type
-
-
-
Method Detail
-
getName
public String getName()
-
setName
public void setName(String name)
Bean name
-
getType
public String getType()
-
setType
public void setType(String type)
What type to use for creating the bean. Can be one of: #class,#type,bean,groovy,joor,language,mvel,ognl. #class or #type then the bean is created via the fully qualified classname, such as #class:com.foo.MyBean The others are scripting languages that gives more power to create the bean with an inlined code in the script section, such as using groovy.
-
getBeanType
public String getBeanType()
-
setBeanType
public void setBeanType(String beanType)
To set the type (fully qualified class name) of the returned bean created by the script. Knowing the type of the bean can be needed when dependency injection by type is in use, or when looking in registry via class type.
-
setBeanType
public void setBeanType(Class<?> beanType)
To set the type (fully qualified class name) of the returned bean created by the script. Knowing the type of the bean can be needed when dependency injection by type is in use, or when looking in registry via class type.
-
getBeanClass
public Class<?> getBeanClass()
-
getProperties
public List<PropertyDefinition> getProperties()
-
setProperties
public void setProperties(List<PropertyDefinition> properties)
Optional properties to set on the created local bean
-
getBeanSupplier
public org.apache.camel.RouteTemplateContext.BeanSupplier<Object> getBeanSupplier()
-
setBeanSupplier
public void setBeanSupplier(org.apache.camel.RouteTemplateContext.BeanSupplier<Object> beanSupplier)
Bean supplier that uses lambda style to create the local bean
-
setScript
public void setScript(String script)
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
public String getScript()
-
type
public T type(String prefix, Class<?> type)
What type to use for creating the bean. Can be one of: #class,#type,bean,groovy,joor,language,mvel,ognl. #class or #type then the bean is created via the fully qualified classname, such as #class:com.foo.MyBean The others are scripting languages that gives more power to create the bean with an inlined code in the script section, such as using groovy.
-
type
public T type(String type)
What type to use for creating the bean. Can be one of: #class,#type,bean,groovy,joor,language,mvel,ognl. #class or #type then the bean is created via the fully qualified classname, such as #class:com.foo.MyBean The others are scripting languages that gives more power to create the bean with an inlined code in the script section, such as using groovy.
-
typeClass
public T typeClass(Class<?> type)
Creates the bean from the given class type- Parameters:
type
- the type of the class to create as bean
-
typeClass
public T typeClass(String type)
Creates the bean from the given class type- Parameters:
type
- the type of the class to create as bean
-
beanType
public T beanType(Class<?> type)
To set the return type of the script (fully qualified class name). Knowing the type of the bean can be needed when dependency injection by type is in use, or when looking in registry via class type.- Parameters:
type
- the fully qualified type of the returned bean from the script
-
beanType
public T beanType(String type)
To set the return type of the script (fully qualified class name). Knowing the type of the bean can be needed when dependency injection by type is in use, or when looking in registry via class type.- Parameters:
type
- the fully qualified type of the returned bean from the script
-
bean
public P bean(Class<?> type)
Calls a method on a bean for creating the local bean- Parameters:
type
- the bean class to call
-
bean
public P bean(Class<?> type, String method)
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
-
groovy
public P groovy(String script)
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
public P joor(String script)
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
-
language
public P language(String language, String script)
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
public P mvel(String script)
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
public P ognl(String script)
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
-
property
public T property(String key, String value)
Sets a property to set on the created local bean- Parameters:
key
- the property namevalue
- the property value
-
properties
public T properties(Map<String,String> properties)
Sets properties to set on the created local bean
-
end
public P end()
-
-