Interface ComponentFactory
-
- All Superinterfaces:
AutoCloseable
,Closeable
,ComponentDescriptorRegistry
,ComponentRegistry
,ConditionalDescriptorRegistry
- All Known Implementing Classes:
ContextAwareComponentFactory
,DefaultComponentFactory
,DelegatingComponentFactory
public interface ComponentFactory extends ComponentRegistry, ComponentDescriptorRegistry, ConditionalDescriptorRegistry, Closeable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
<T> boolean
containsComponent(Class<T> type)
Checks if at least one component is registered for the given type.<T> boolean
containsComponent(Class<T> type, Qualifier<T> qualifier)
Checks if at least one component is registered for the given type and qualifier.boolean
containsComponent(String type)
Checks if at least one component is registered for the given type.<T> boolean
containsComponent(String type, Qualifier<T> qualifier)
Checks if at least one component is registered for the given type and qualifier.<T> Collection<GettableComponent<T>>
getAllComponentProviders(Class<T> type, Qualifier<T> qualifier)
Gets all instances, which may be shared or independent, for the specified type.<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 type, Conf conf)
Gets all instances, which may be shared or independent, for the specified type.<T> Collection<T>
getAllComponents(String type, 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 type, Conf conf)
Gets an instance, which may be shared or independent, for the specified type.<T> T
getComponent(String type, Conf conf, Qualifier<T> qualifier)
Gets an instance, which may be shared or independent, for the specified type.<T> GettableComponent<T>
getComponentProvider(Class<T> type, Qualifier<T> qualifier)
Gets an instance, which may be shared or independent, for the specified type.void
init(Conf conf)
Initialize the component factory for the given configuration.-
Methods inherited from interface io.streamthoughts.azkarra.api.components.ComponentDescriptorRegistry
findAllDescriptorsByAlias, findAllDescriptorsByAlias, findAllDescriptorsByClass, findAllDescriptorsByClass, findDescriptorByAlias, findDescriptorByAlias, findDescriptorByClass, findDescriptorByClass, registerDescriptor
-
Methods inherited from interface io.streamthoughts.azkarra.api.components.ComponentRegistry
registerComponent, registerComponent, registerComponent, registerComponent, registerSingleton, registerSingleton, registerSingleton, registerSingleton, registerSingleton
-
Methods inherited from interface io.streamthoughts.azkarra.api.components.ConditionalDescriptorRegistry
findAllDescriptorsByAlias, findAllDescriptorsByAlias, findAllDescriptorsByClass, findAllDescriptorsByClass, findDescriptorByAlias, findDescriptorByAlias, findDescriptorByClass, findDescriptorByClass
-
-
-
-
Method Detail
-
containsComponent
boolean containsComponent(String type)
Checks if at least one component is registered for the given type.- Parameters:
type
- the fully qualified class name or an alias of the component.- Returns:
true
if a provider exist,false
otherwise.
-
containsComponent
<T> boolean containsComponent(String type, Qualifier<T> qualifier)
Checks if at least one component is registered for the given type and qualifier.- Parameters:
type
- the component type.qualifier
- the options to qualified the component.- Returns:
true
if a provider exist,false
otherwise.
-
containsComponent
<T> boolean containsComponent(Class<T> type)
Checks if at least one component is registered for the given type.- Parameters:
type
- the component type.- Returns:
true
if a provider exist,false
otherwise.
-
containsComponent
<T> boolean containsComponent(Class<T> type, Qualifier<T> qualifier)
Checks if at least one component is registered for the given type and qualifier.- Parameters:
type
- the component type.qualifier
- the options to qualified the component.- Returns:
true
if a provider exist,false
otherwise.
-
getComponent
<T> T getComponent(Class<T> type, Conf conf)
Gets an instance, which may be shared or independent, for the specified type.- 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
. - Throws:
NoUniqueComponentException
- if more than one component is registered for the given type.NoSuchComponentException
- if no component is registered for the given type.
-
getComponent
<T> T getComponent(Class<T> type, Conf conf, Qualifier<T> qualifier)
Gets an instance, which may be shared or independent, for the specified type.- 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
. - Throws:
NoUniqueComponentException
- if more than one component is registered for the given type.NoSuchComponentException
- if no component is registered for the given type.
-
getComponentProvider
<T> GettableComponent<T> getComponentProvider(Class<T> type, Qualifier<T> qualifier)
Gets an instance, which may be shared or independent, for the specified type.- Type Parameters:
T
- the component-type.- Parameters:
type
- the component class.qualifier
- the options used to qualified the component.- Returns:
- the instance of type
ComponentFactory
. - Throws:
NoUniqueComponentException
- if more than one component is registered for the given type.NoSuchComponentException
- if no component is registered for the given type.
-
getComponent
<T> T getComponent(String type, 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.- Type Parameters:
T
- the component-type.- Parameters:
type
- 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
. - Throws:
NoUniqueComponentException
- if more than one component is registered for the given type.NoSuchComponentException
- if no component is registered for the given class or alias..
-
getComponent
<T> T getComponent(String type, 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.- Type Parameters:
T
- the component-type.- Parameters:
type
- 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
. - Throws:
NoUniqueComponentException
- if more than one component is registered for the given type.NoSuchComponentException
- if no component is registered for the given class or alias..
-
getAllComponents
<T> Collection<T> getAllComponents(String 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.- Type Parameters:
T
- the component-type.- Parameters:
type
- 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
<T> Collection<T> getAllComponents(String 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.- Type Parameters:
T
- the component-type.- Parameters:
type
- 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
<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.- 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
<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.- Type Parameters:
T
- the component-type.- Parameters:
type
- the component class.conf
- the configuration used if the component implementConfigurable
.conf
- theConf
that may be used to match componentsCondition
.qualifier
- the options used to qualify the component.- Returns:
- all instances of type
ComponentFactory
.
-
getAllComponentProviders
<T> Collection<GettableComponent<T>> getAllComponentProviders(Class<T> type, Qualifier<T> qualifier)
Gets all instances, which may be shared or independent, for the specified type.- Type Parameters:
T
- the component-type.- Parameters:
type
- the component class.qualifier
- the options used to qualify the component.- Returns:
- all instances of type
ComponentFactory
.
-
init
void init(Conf conf)
Initialize the component factory for the given configuration.- Parameters:
conf
- the configuration.
-
close
void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-