Class ComponentModule<T>
- java.lang.Object
-
- io.streamthoughts.azkarra.api.components.ComponentModule<T>
-
- All Implemented Interfaces:
ComponentFactory<T>
,ComponentRegistryAware
,Configurable
- Direct Known Subclasses:
ComplexWordCountTopologyModule
public abstract class ComponentModule<T> extends Object implements ComponentFactory<T>, ComponentRegistryAware, Configurable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.streamthoughts.azkarra.api.components.ComponentFactory
ComponentFactory.SimpleFactory<T>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ComponentModule(Class<T> type)
Creates a newComponentModule
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Conf
configuration()
void
configure(Conf configuration)
Configures this instance with the specifiedConf
.protected <C> Collection<C>
getAllComponentsForType(Class<C> type)
Gets all instances, which may be shared or independent, for the specified type.protected <C> C
getComponentForClassOrAlias(String classOrAlias)
Gets an instance, which may be shared or independent, for the specified type.protected <C> C
getComponentForType(Class<C> type)
Gets an instance, which may be shared or independent, for the specified type.Class<T>
getType()
Returns the type of the component created by thisComponentFactory
.void
setRegistry(ComponentRegistry registry)
Sets the registry.-
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.ComponentFactory
isSingleton, make
-
-
-
-
Constructor Detail
-
ComponentModule
protected ComponentModule(Class<T> type)
Creates a newComponentModule
instance.- Parameters:
type
- the component type.
-
-
Method Detail
-
getType
public Class<T> getType()
Returns the type of the component created by thisComponentFactory
.- Specified by:
getType
in interfaceComponentFactory<T>
- Returns:
- a
Class
instance.
-
setRegistry
public void setRegistry(ComponentRegistry registry)
Sets the registry.- Specified by:
setRegistry
in interfaceComponentRegistryAware
- Parameters:
registry
- theComponentRegistry
instance.
-
configure
public void configure(Conf configuration)
Configures this instance with the specifiedConf
.- Specified by:
configure
in interfaceConfigurable
- Parameters:
configuration
- theConf
instance used to configure this instance.
-
configuration
protected Conf configuration()
-
getComponentForType
protected <C> C getComponentForType(Class<C> type)
Gets an instance, which may be shared or independent, for the specified type.- Type Parameters:
C
- the component-type.- Parameters:
type
- the component class.- Returns:
- the instance of type
ComponentModule
. - Throws:
NoUniqueComponentException
- if more than one component is registered for the given type.NoSuchComponentException
- if no component is registered for the given type.
-
getComponentForClassOrAlias
protected <C> C getComponentForClassOrAlias(String classOrAlias)
Gets an instance, which may be shared or independent, for the specified type.- Type Parameters:
C
- the component-type.- Parameters:
classOrAlias
- the fully qualified class name or an alias of the component.- Returns:
- the instance of type
ComponentModule
. - 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..
-
getAllComponentsForType
protected <C> Collection<C> getAllComponentsForType(Class<C> type)
Gets all instances, which may be shared or independent, for the specified type.- Type Parameters:
C
- the component-type.- Parameters:
type
- the component class.- Returns:
- the instance of type
ComponentModule
.
-
-