Package org.apache.camel.spi
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 Summary
Modifier and TypeMethodDescription<T> Set<T>
findByType
(Class<T> type) Finds beans in the registry by their type.findByTypeWithName
(Class<T> type) Finds beans in the registry by their type.default <T> T
findSingleByType
(Class<T> type) Finds the bean by type, if there is exactly only one instance of the beanlookupByName
(String name) Looks up a bean in the registry based purely on name, returning the bean or null if it could not be found.<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.default Object
Strategy to wrap the value to be stored in the registry.
-
Method Details
-
lookupByName
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 thelookupByNameAndType(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
Looks up a bean in the registry, returning the bean or null if it could not be found.- Parameters:
name
- the name of the beantype
- the type of the required bean- Returns:
- the bean from the registry or null if it could not be found
-
findByTypeWithName
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
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.
-
findSingleByType
Finds the bean by type, if there is exactly only one instance of the bean- Parameters:
type
- the type of the beans- Returns:
- the single bean instance, or null if none found or there are more than one bean of the given type.
-
unwrap
Strategy to wrap the value to be stored in the registry.- Parameters:
value
- the value- Returns:
- the value to return
-