Package org.apache.camel.spi
Interface Registry
-
- All Superinterfaces:
BeanRepository
public interface Registry extends BeanRepository
Represents aBeanRepository
which may also be capable of binding beans to its repository.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
bind(String id, Class<?> type, Object bean)
Binds the bean to the repository (if possible).void
bind(String id, Class<?> type, Supplier<Object> bean)
Binds the bean (via a supplier) to the repository (if possible).default void
bind(String id, Object bean)
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 Object
wrap(Object value)
Strategy to wrap the value to be stored in the registry.-
Methods inherited from interface org.apache.camel.spi.BeanRepository
findByType, findByTypeWithName, lookupByName, lookupByNameAndType, unwrap
-
-
-
-
Method Detail
-
bind
default void bind(String id, Object bean) throws RuntimeCamelException
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
void bind(String id, Class<?> type, Object bean) throws RuntimeCamelException
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
void bind(String id, Class<?> type, Supplier<Object> bean) throws RuntimeCamelException
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
void bindAsPrototype(String id, Class<?> type, Supplier<Object> bean) throws RuntimeCamelException
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
-
-