Package org.exoplatform.container.spi
Interface ComponentAdapter<T>
- All Superinterfaces:
ComponentAdapter<T>
- All Known Implementing Classes:
AbstractComponentAdapter,InstanceComponentAdapter,ManageableComponentAdapter,MX4JComponentAdapter
A component adapter is responsible for providing a specific component instance. An instance of an implementation of
this interface is used inside a
Container for every registered component or instance. Each
ComponentAdapter instance has to have a key which is unique within that container. The key itself is
either a class type (normally an interface) or an identifier.-
Method Summary
Modifier and TypeMethodDescriptionRetrieve the class of the component.Retrieve the component instance.Retrieve the key associated with the component.booleanIndicates whether or not this adapter is a singleton
-
Method Details
-
getComponentKey
Object getComponentKey()Retrieve the key associated with the component.- Specified by:
getComponentKeyin interfaceComponentAdapter<T>- Returns:
- the component's key. Should either be a class type (normally an interface) or an identifier that is unique (within the scope of the current Container).
-
getComponentImplementation
Retrieve the class of the component.- Specified by:
getComponentImplementationin interfaceComponentAdapter<T>- Returns:
- the component's implementation class. Should normally be a concrete class (ie, a class that can be instantiated).
-
getComponentInstance
Retrieve the component instance. This method will usually create a new instance each time it is called, but that is not required.- Returns:
- the component instance.
- Throws:
ContainerException- if the component could not be instantiated. Or if the component has dependencies which could not be resolved, or instantiation of the component lead to an ambiguous situation within the container.
-
isSingleton
boolean isSingleton()Indicates whether or not this adapter is a singleton
-