Package org.apache.camel.spi
Interface Registry
- All Superinterfaces:
BeanRepository
Represents a
BeanRepository
which may also be capable of binding beans to its repository.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Binds the bean to the repository (if possible).void
Binds the bean (via a supplier) to the repository (if possible).default void
Binds the bean to the repository (if possible).void
bindAsPrototype
(String id, Class<?> type, Supplier<Object> bean) Binds the bean (via a supplier) to the repository (if possible).default void
Removes the bean from the repository (if possible).default Object
Strategy to wrap the value to be stored in the registry.Methods inherited from interface org.apache.camel.spi.BeanRepository
findByType, findByTypeWithName, findSingleByType, lookupByName, lookupByNameAndType, unwrap
-
Method Details
-
bind
Binds the bean to the repository (if possible). If the bean isCamelContextAware
then the registry will automatic inject the context if possible.- Parameters:
id
- the id of the beanbean
- the bean- Throws:
RuntimeCamelException
- is thrown if binding is not possible
-
bind
Binds the bean to the repository (if possible). Binding by id and type allows to bind multiple entries with the same id but with different type. If the bean isCamelContextAware
then the registry will automatic inject the context if possible.- Parameters:
id
- the id of the beantype
- the type of the bean to associate the bindingbean
- the bean- Throws:
RuntimeCamelException
- is thrown if binding is not possible
-
bind
Binds the bean (via a supplier) to the repository (if possible). Camel will cache the result from the supplier from first lookup (singleton scope). If you do not need cached then usebindAsPrototype(String, Class, Supplier)
instead. Binding by id and type allows to bind multiple entries with the same id but with different type.- Parameters:
id
- the id of the beantype
- the type of the bean to associate the bindingbean
- a supplier for the bean- Throws:
RuntimeCamelException
- is thrown if binding is not possible
-
bindAsPrototype
Binds the bean (via a supplier) to the repository (if possible). Notice that the supplier will be called each time the bean is being looked up (not cached). Binding by id and type allows to bind multiple entries with the same id but with different type.- Parameters:
id
- the id of the beantype
- the type of the bean to associate the bindingbean
- a supplier for the bean- Throws:
RuntimeCamelException
- is thrown if binding is not possible
-
unbind
Removes the bean from the repository (if possible).- Parameters:
id
- the id of the bean
-
wrap
Strategy to wrap the value to be stored in the registry.- Parameters:
value
- the value- Returns:
- the value to store
-