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
ThingHandlers- Author:
- Stefan Triller - Initial contribution, Laurent Garnier - Injected components AnnotationActionModuleTypeHelper and ActionInputsHelper
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedThingActionModuleTypeProvider(ModuleTypeI18nService moduleTypeI18nService, AnnotationActionModuleTypeHelper helper, ActionInputsHelper actionInputsHelper) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotatedThingActions(ThingActions annotatedThingActions) voidAdds aProviderChangeListenerwhich must be notified if there are changes concerning the elements provided by theProvider.protected voidShould 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 localizedModuleTypedefined by this provider.<T extends ModuleType>
Collection<T> getModuleTypes(@Nullable Locale locale) Gets the localizedModuleTypes defined by this provider.getTypes()Returns the UIDs of the module types currently supported by this factory.protected @Nullable ModuleHandlerinternalCreate(Module module, String ruleUID) voidremoveAnnotatedThingActions(ThingActions annotatedThingActions) voidRemoves 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:BaseModuleHandlerFactoryShould be overridden by the implementations that extend this base class. Called from DS to deactivate theModuleHandlerFactory.- Overrides:
deactivatein classBaseModuleHandlerFactory
-
addProviderChangeListener
Description copied from interface:ProviderAdds aProviderChangeListenerwhich must be notified if there are changes concerning the elements provided by theProvider.- Specified by:
addProviderChangeListenerin interfaceProvider<ModuleType>- Parameters:
listener- the listener to be added
-
removeProviderChangeListener
Description copied from interface:ProviderRemoves aProviderChangeListener.- Specified by:
removeProviderChangeListenerin interfaceProvider<ModuleType>- Parameters:
listener- the listener to be removed.
-
getAll
Description copied from interface:ProviderReturns a collection of all elements.- Specified by:
getAllin interfaceProvider<ModuleType>- Returns:
- collection of all elements
-
getModuleType
Description copied from interface:ModuleTypeProviderGets the localizedModuleTypedefined by this provider. When the localization is not specified or it is not supported aModuleTypewith default locale is returned.- Specified by:
getModuleTypein interfaceModuleTypeProvider- Type Parameters:
T- the type of the required object.- Parameters:
uid- unique identifier of theModuleType.locale- defines localization of label and description of theModuleTypeor null.- Returns:
- localized module type.
-
getModuleTypes
Description copied from interface:ModuleTypeProviderGets the localizedModuleTypes defined by this provider. When localization is not specified or it is not supported theModuleTypes with default localization is returned.- Specified by:
getModuleTypesin interfaceModuleTypeProvider- Type Parameters:
T- the type of the required object.- Parameters:
locale- defines localization of label and description of theModuleTypes or null.- Returns:
- collection of localized
ModuleTypeprovided by this provider.
-
addAnnotatedThingActions
-
removeAnnotatedThingActions
-
getTypes
Description copied from interface:ModuleHandlerFactoryReturns the UIDs of the module types currently supported by this factory. AModuleHandlerFactoryinstance can add new types to this list, but should not remove. If a module type is no longer supported, theModuleHandlerFactoryservice must be unregistered, and then registered again with the new list.If two or more
ModuleHandlerFactorys 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:
getTypesin interfaceModuleHandlerFactory- Returns:
- collection of module type UIDs supported by this factory.
-
internalCreate
Description copied from class:BaseModuleHandlerFactory- Specified by:
internalCreatein classBaseModuleHandlerFactory- Parameters:
module- theModulefor which a handler should be created.ruleUID- the identifier of theRulethat the given module belongs to.- Returns:
- a
ModuleHandlerinstance ornullif this module type is not supported.
-