Class AnnotatedThingActionModuleTypeProvider
java.lang.Object
org.openhab.core.automation.handler.BaseModuleHandlerFactory
org.openhab.core.automation.thingsupport.AnnotatedThingActionModuleTypeProvider
- All Implemented Interfaces:
ModuleHandlerFactory
,ModuleTypeProvider
,Provider<ModuleType>
@NonNullByDefault
public class AnnotatedThingActionModuleTypeProvider
extends BaseModuleHandlerFactory
implements ModuleTypeProvider
ModuleTypeProvider that collects actions for
ThingHandler
s- Author:
- Stefan Triller - Initial contribution, Laurent Garnier - Injected components AnnotationActionModuleTypeHelper and ActionInputsHelper
-
Constructor Summary
ConstructorDescriptionAnnotatedThingActionModuleTypeProvider
(ModuleTypeI18nService moduleTypeI18nService, AnnotationActionModuleTypeHelper helper, ActionInputsHelper actionInputsHelper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotatedThingActions
(ThingActions annotatedThingActions) void
Adds aProviderChangeListener
which must be notified if there are changes concerning the elements provided by theProvider
.protected void
Should be overridden by the implementations that extend this base class.getAll()
Returns a collection of all elements.<T extends ModuleType>
TgetModuleType
(String uid, @Nullable Locale locale) Gets the localizedModuleType
defined by this provider.<T extends ModuleType>
Collection<T>getModuleTypes
(@Nullable Locale locale) Gets the localizedModuleType
s defined by this provider.getTypes()
Returns the UIDs of the module types currently supported by this factory.protected @Nullable ModuleHandler
internalCreate
(Module module, String ruleUID) void
removeAnnotatedThingActions
(ThingActions annotatedThingActions) void
Removes aProviderChangeListener
.Methods inherited from class org.openhab.core.automation.handler.BaseModuleHandlerFactory
getHandler, getHandlers, getModuleIdentifier, ungetHandler
-
Constructor Details
-
AnnotatedThingActionModuleTypeProvider
public AnnotatedThingActionModuleTypeProvider(ModuleTypeI18nService moduleTypeI18nService, AnnotationActionModuleTypeHelper helper, ActionInputsHelper actionInputsHelper)
-
-
Method Details
-
deactivate
protected void deactivate()Description copied from class:BaseModuleHandlerFactory
Should be overridden by the implementations that extend this base class. Called from DS to deactivate theModuleHandlerFactory
.- Overrides:
deactivate
in classBaseModuleHandlerFactory
-
addProviderChangeListener
Description copied from interface:Provider
Adds aProviderChangeListener
which must be notified if there are changes concerning the elements provided by theProvider
.- Specified by:
addProviderChangeListener
in interfaceProvider<ModuleType>
- Parameters:
listener
- the listener to be added
-
removeProviderChangeListener
Description copied from interface:Provider
Removes aProviderChangeListener
.- Specified by:
removeProviderChangeListener
in interfaceProvider<ModuleType>
- Parameters:
listener
- the listener to be removed.
-
getAll
Description copied from interface:Provider
Returns a collection of all elements.- Specified by:
getAll
in interfaceProvider<ModuleType>
- Returns:
- collection of all elements
-
getModuleType
Description copied from interface:ModuleTypeProvider
Gets the localizedModuleType
defined by this provider. When the localization is not specified or it is not supported aModuleType
with default locale is returned.- Specified by:
getModuleType
in interfaceModuleTypeProvider
- Type Parameters:
T
- the type of the required object.- Parameters:
uid
- unique identifier of theModuleType
.locale
- defines localization of label and description of theModuleType
or null.- Returns:
- localized module type.
-
getModuleTypes
Description copied from interface:ModuleTypeProvider
Gets the localizedModuleType
s defined by this provider. When localization is not specified or it is not supported theModuleType
s with default localization is returned.- Specified by:
getModuleTypes
in interfaceModuleTypeProvider
- Type Parameters:
T
- the type of the required object.- Parameters:
locale
- defines localization of label and description of theModuleType
s or null.- Returns:
- collection of localized
ModuleType
provided by this provider.
-
addAnnotatedThingActions
-
removeAnnotatedThingActions
-
getTypes
Description copied from interface:ModuleHandlerFactory
Returns the UIDs of the module types currently supported by this factory. AModuleHandlerFactory
instance can add new types to this list, but should not remove. If a module type is no longer supported, theModuleHandlerFactory
service must be unregistered, and then registered again with the new list.If two or more
ModuleHandlerFactory
s support the same module type, the Rule Engine will choose one of them randomly. Once a factory is chosen, it will be used to create instances of this module type until its service is unregistered.- Specified by:
getTypes
in interfaceModuleHandlerFactory
- Returns:
- collection of module type UIDs supported by this factory.
-
internalCreate
Description copied from class:BaseModuleHandlerFactory
- Specified by:
internalCreate
in classBaseModuleHandlerFactory
- Parameters:
module
- theModule
for which a handler should be created.ruleUID
- the identifier of theRule
that the given module belongs to.- Returns:
- a
ModuleHandler
instance ornull
if this module type is not supported.
-