Interface BeanRepository

  • All Known Subinterfaces:
    Registry

    public interface BeanRepository
    Represents a bean repository used to lookup components by name and type. This allows Camel to plugin to third-party bean repositories such as Spring, JNDI, OSGi.
    • Method Detail

      • lookupByName

        Object lookupByName​(String name)
        Looks up a bean in the registry based purely on name, returning the bean or null if it could not be found.

        Important: Multiple beans of different types may be bound with the same name, and its encouraged to use the lookupByNameAndType(String, Class) to lookup the bean with a specific type, or to use any of the find methods.

        Parameters:
        name - the name of the bean
        Returns:
        the bean from the registry or null if it could not be found
      • lookupByNameAndType

        <T> T lookupByNameAndType​(String name,
                                  Class<T> type)
        Looks up a bean in the registry, returning the bean or null if it could not be found.
        Parameters:
        name - the name of the bean
        type - the type of the required bean
        Returns:
        the bean from the registry or null if it could not be found
      • findByTypeWithName

        <T> Map<String,​T> findByTypeWithName​(Class<T> type)
        Finds beans in the registry by their type.
        Parameters:
        type - the type of the beans
        Returns:
        the types found, with their bean ids as the key. Returns an empty Map if none found.
      • findByType

        <T> Set<T> findByType​(Class<T> type)
        Finds beans in the registry by their type.
        Parameters:
        type - the type of the beans
        Returns:
        the types found. Returns an empty Set if none found.
      • unwrap

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