Class ContextAwareComponentFactory
- java.lang.Object
-
- io.streamthoughts.azkarra.api.components.DelegatingComponentFactory
-
- io.streamthoughts.azkarra.api.components.ContextAwareComponentFactory
-
- All Implemented Interfaces:
ComponentDescriptorRegistry
,ComponentFactory
,ComponentRegistry
,ConditionalDescriptorRegistry
,Closeable
,AutoCloseable
public class ContextAwareComponentFactory extends DelegatingComponentFactory
-
-
Field Summary
-
Fields inherited from class io.streamthoughts.azkarra.api.components.DelegatingComponentFactory
factory
-
-
Constructor Summary
Constructors Constructor Description ContextAwareComponentFactory(AzkarraContext context, ComponentFactory factory)
Creates a newContextAwareComponentFactory
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Collection<T>
getAllComponents(Class<T> type, Conf conf)
Gets all instances, which may be shared or independent, for the specified type.<T> Collection<T>
getAllComponents(Class<T> type, Conf conf, Qualifier<T> qualifier)
Gets all instances, which may be shared or independent, for the specified type.<T> Collection<T>
getAllComponents(String alias, Conf conf)
Gets all instances, which may be shared or independent, for the specified type.<T> Collection<T>
getAllComponents(String alias, Conf conf, Qualifier<T> qualifier)
Gets all instances, which may be shared or independent, for the specified type.<T> T
getComponent(Class<T> type, Conf conf)
Gets an instance, which may be shared or independent, for the specified type.<T> T
getComponent(Class<T> type, Conf conf, Qualifier<T> qualifier)
Gets an instance, which may be shared or independent, for the specified type.<T> T
getComponent(String alias, Conf conf)
Gets an instance, which may be shared or independent, for the specified type.<T> T
getComponent(String alias, Conf conf, Qualifier<T> qualifier)
Gets an instance, which may be shared or independent, for the specified type.-
Methods inherited from class io.streamthoughts.azkarra.api.components.DelegatingComponentFactory
close, containsComponent, containsComponent, containsComponent, containsComponent, findAllDescriptorsByAlias, findAllDescriptorsByAlias, findAllDescriptorsByAlias, findAllDescriptorsByAlias, findAllDescriptorsByClass, findAllDescriptorsByClass, findAllDescriptorsByClass, findAllDescriptorsByClass, findDescriptorByAlias, findDescriptorByAlias, findDescriptorByAlias, findDescriptorByAlias, findDescriptorByClass, findDescriptorByClass, findDescriptorByClass, findDescriptorByClass, getAllComponentProviders, getComponentProvider, init, registerComponent, registerComponent, registerDescriptor, registerSingleton, registerSingleton, registerSingleton
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.streamthoughts.azkarra.api.components.ComponentRegistry
registerComponent, registerComponent, registerSingleton, registerSingleton
-
-
-
-
Constructor Detail
-
ContextAwareComponentFactory
public ContextAwareComponentFactory(AzkarraContext context, ComponentFactory factory)
Creates a newContextAwareComponentFactory
instance.- Parameters:
context
- theAzkarraContext
.
-
-
Method Detail
-
getComponent
public <T> T getComponent(Class<T> type, Conf conf)
Gets an instance, which may be shared or independent, for the specified type.- Specified by:
getComponent
in interfaceComponentFactory
- Overrides:
getComponent
in classDelegatingComponentFactory
- Type Parameters:
T
- the component-type.- Parameters:
type
- the component class.conf
- the configuration used if the component implementConfigurable
.- Returns:
- the instance of type
ComponentFactory
.
-
getComponent
public <T> T getComponent(Class<T> type, Conf conf, Qualifier<T> qualifier)
Gets an instance, which may be shared or independent, for the specified type.- Specified by:
getComponent
in interfaceComponentFactory
- Overrides:
getComponent
in classDelegatingComponentFactory
- Type Parameters:
T
- the component-type.- Parameters:
type
- the component class.conf
- the configuration used if the component implementConfigurable
.qualifier
- the options used to qualify the component.- Returns:
- the instance of type
ComponentFactory
.
-
getComponent
public <T> T getComponent(String alias, Conf conf)
Gets an instance, which may be shared or independent, for the specified type. If the object, returned from that method, implements theConfigurable
interface, then the factory will invoke the methodConfigurable.configure(Conf)
with the givenConf
. For a shared object, the method will be invoked only the first time it is returned.- Specified by:
getComponent
in interfaceComponentFactory
- Overrides:
getComponent
in classDelegatingComponentFactory
- Type Parameters:
T
- the component-type.- Parameters:
alias
- the fully qualified class name or an alias of the component.conf
- the configuration used if the component implementConfigurable
.- Returns:
- the instance of type
ComponentFactory
.
-
getComponent
public <T> T getComponent(String alias, Conf conf, Qualifier<T> qualifier)
Gets an instance, which may be shared or independent, for the specified type. If the object, returned from that method, implements theConfigurable
interface, then the factory will invoke the methodConfigurable.configure(Conf)
with the givenConf
. For a shared object, the method will be invoked only the first time it is returned.- Specified by:
getComponent
in interfaceComponentFactory
- Overrides:
getComponent
in classDelegatingComponentFactory
- Type Parameters:
T
- the component-type.- Parameters:
alias
- the fully qualified class name or an alias of the component.conf
- the configuration used if the component implementConfigurable
.qualifier
- the options used to qualify the component.- Returns:
- the instance of type
ComponentFactory
.
-
getAllComponents
public <T> Collection<T> getAllComponents(String alias, Conf conf)
Gets all instances, which may be shared or independent, for the specified type. If one of the objects, returned from that method, implements theConfigurable
interface, then the factory will invoke the methodConfigurable.configure(Conf)
with the givenConf
. For a shared object, the method will be invoked only the first time it is returned.- Specified by:
getAllComponents
in interfaceComponentFactory
- Overrides:
getAllComponents
in classDelegatingComponentFactory
- Type Parameters:
T
- the component-type.- Parameters:
alias
- the fully qualified class name or an alias of the component.conf
- the configuration used if the component implementConfigurable
.- Returns:
- all instances of type
ComponentFactory
.
-
getAllComponents
public <T> Collection<T> getAllComponents(String alias, Conf conf, Qualifier<T> qualifier)
Gets all instances, which may be shared or independent, for the specified type. If one of the objects, returned from that method, implements theConfigurable
interface, then the factory will invoke the methodConfigurable.configure(Conf)
with the givenConf
. For a shared object, the method will be invoked only the first time it is returned.- Specified by:
getAllComponents
in interfaceComponentFactory
- Overrides:
getAllComponents
in classDelegatingComponentFactory
- Type Parameters:
T
- the component-type.- Parameters:
alias
- the fully qualified class name or an alias of the component.conf
- the configuration used if the component implementConfigurable
.qualifier
- the options used to qualify the component.- Returns:
- all instances of type
ComponentFactory
.
-
getAllComponents
public <T> Collection<T> getAllComponents(Class<T> type, Conf conf)
Gets all instances, which may be shared or independent, for the specified type. If one of the objects, returned from that method, implements theConfigurable
interface, then the factory will invoke the methodConfigurable.configure(Conf)
with the givenConf
. For a shared object, the method will be invoked only the first time it is returned.- Specified by:
getAllComponents
in interfaceComponentFactory
- Overrides:
getAllComponents
in classDelegatingComponentFactory
- Type Parameters:
T
- the component-type.- Parameters:
type
- the component class.conf
- the configuration used if the component implementConfigurable
.- Returns:
- all instances of type
ComponentFactory
.
-
getAllComponents
public <T> Collection<T> getAllComponents(Class<T> type, Conf conf, Qualifier<T> qualifier)
Gets all instances, which may be shared or independent, for the specified type. If one of the objects, returned from that method, implements theConfigurable
interface, then the factory will invoke the methodConfigurable.configure(Conf)
with the givenConf
. For a shared object, the method will be invoked only the first time it is returned.- Specified by:
getAllComponents
in interfaceComponentFactory
- Overrides:
getAllComponents
in classDelegatingComponentFactory
- Type Parameters:
T
- the component-type.- Parameters:
type
- the component class.conf
- the configuration used if the component implementConfigurable
.qualifier
- the options used to qualify the component.- Returns:
- all instances of type
ComponentFactory
.
-
-