@Role public interface ComponentManager
Modifier and Type | Method and Description |
---|---|
<T> ComponentDescriptor<T> |
getComponentDescriptor(Type role,
String hint) |
<T> List<ComponentDescriptor<T>> |
getComponentDescriptorList(Class<T> role)
Deprecated.
since 4.0M1 use
getComponentDescriptorList(Type) instead |
<T> List<ComponentDescriptor<T>> |
getComponentDescriptorList(Type role) |
ComponentEventManager |
getComponentEventManager() |
<T> T |
getInstance(Type roleType)
Find a component instance that implements that passed type.
|
<T> T |
getInstance(Type roleType,
String roleHint)
Find a component instance that implements that passed interface class.
|
<T> List<T> |
getInstanceList(Type role)
Find all the components implementing the provided role.
|
<T> Map<String,T> |
getInstanceMap(Type role)
Find all the components implementing the provided role and organize then in a
Map with role hint as key. |
ComponentManager |
getParent() |
boolean |
hasComponent(Type role) |
boolean |
hasComponent(Type role,
String hint) |
<T> void |
registerComponent(ComponentDescriptor<T> componentDescriptor)
Add a component in the component repository dynamically.
|
<T> void |
registerComponent(ComponentDescriptor<T> componentDescriptor,
T componentInstance)
Add a component in the component repository dynamically.
|
void |
release(Object componentInstance)
Release the provided singleton instance but don't unregister the component descriptor.
|
void |
setComponentEventManager(ComponentEventManager eventManager) |
void |
setParent(ComponentManager parentComponentManager) |
void |
unregisterComponent(ComponentDescriptor<?> componentDescriptor)
Remove a component from the component repository dynamically.
|
void |
unregisterComponent(Type role,
String hint)
Remove a component from the component repository dynamically.
|
boolean hasComponent(Type role)
role
- the class (aka role) that the component implementsboolean hasComponent(Type role, String hint)
role
- the class (aka role) that the component implementshint
- the hint that differentiates a component implementation from another one (each component is
registered with a hint; the "default" hint being the default)<T> T getInstance(Type roleType) throws ComponentLookupException
T
- the component role typeroleType
- the class (aka role) that the component implementsComponentLookupException
- in case the component cannot be found<T> T getInstance(Type roleType, String roleHint) throws ComponentLookupException
T
- the component role typeroleType
- the class (aka role) that the component implementsroleHint
- the hint that differentiates a component implementation from another one (each component is
registered with a hint; the "default" hint being the default)ComponentLookupException
- in case the component cannot be foundvoid release(Object componentInstance) throws ComponentLifecycleException
componentInstance
- the component to release passed as a component instance.ComponentLifecycleException
- if the component's ending lifecycle raises an error<T> List<T> getInstanceList(Type role) throws ComponentLookupException
T
- the type of the components rolerole
- the type of the components roleComponentLookupException
- if any error happen during component search<T> Map<String,T> getInstanceMap(Type role) throws ComponentLookupException
Map
with role hint as key.T
- the type of the components rolerole
- the type of the components roleComponentLookupException
- if any error happen during component search<T> void registerComponent(ComponentDescriptor<T> componentDescriptor) throws ComponentRepositoryException
If a component with the same role and role hint already exists it will be replaced by this provided one when lookup.
T
- the component role typecomponentDescriptor
- the descriptor of the component to register.ComponentRepositoryException
- error when registering component descriptor.<T> void registerComponent(ComponentDescriptor<T> componentDescriptor, T componentInstance) throws ComponentRepositoryException
ComponentManager
instead of letting it created it from descriptor.
If a component with the same role and role hint already exists it will be replaced by this provided one when lookup.
T
- the component role typecomponentDescriptor
- the descriptor of the component to register.componentInstance
- the initial component instanceComponentRepositoryException
- error when registering component descriptor.void unregisterComponent(Type role, String hint)
role
- the role identifying the componenthint
- the hint identifying the componentvoid unregisterComponent(ComponentDescriptor<?> componentDescriptor)
componentDescriptor
- the component descriptor<T> ComponentDescriptor<T> getComponentDescriptor(Type role, String hint)
T
- the component role typerole
- the role identifying the componenthint
- the hint identifying the component<T> List<ComponentDescriptor<T>> getComponentDescriptorList(Type role)
T
- the role class for which to return all component implementationsrole
- the role class for which to return all component implementationsComponentEventManager getComponentEventManager()
void setComponentEventManager(ComponentEventManager eventManager)
eventManager
- the manager to use to send events when a component descriptor is registeredComponentManager getParent()
void setParent(ComponentManager parentComponentManager)
parentComponentManager
- see getParent()
@Deprecated <T> List<ComponentDescriptor<T>> getComponentDescriptorList(Class<T> role)
getComponentDescriptorList(Type)
insteadT
- the role class for which to return all component implementationsrole
- the role class for which to return all component implementationsCopyright © 2004–2021 XWiki. All rights reserved.