Interface Registry

All Superinterfaces:
BeanRepository

public interface Registry extends BeanRepository
Represents a BeanRepository which may also be capable of binding beans to its repository.
  • Method Details

    • bind

      default void bind(String id, Object bean) throws RuntimeCamelException
      Binds the bean to the repository (if possible). If the bean is CamelContextAware then the registry will automatic inject the context if possible.
      Parameters:
      id - the id of the bean
      bean - 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 is CamelContextAware then the registry will automatic inject the context if possible.

      Parameters:
      id - the id of the bean
      type - the type of the bean to associate the binding
      bean - 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 use bindAsPrototype(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 bean
      type - the type of the bean to associate the binding
      bean - 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 bean
      type - the type of the bean to associate the binding
      bean - a supplier for the bean
      Throws:
      RuntimeCamelException - is thrown if binding is not possible
    • unbind

      default void unbind(String id)
      Removes the bean from the repository (if possible).
      Parameters:
      id - the id of the bean
    • wrap

      default Object wrap(Object value)
      Strategy to wrap the value to be stored in the registry.
      Parameters:
      value - the value
      Returns:
      the value to store