Package org.openhab.core.thing.binding
Class AbstractStorageBasedTypeProvider
java.lang.Object
org.openhab.core.thing.binding.AbstractStorageBasedTypeProvider
- All Implemented Interfaces:
ThingTypeProvider,ChannelGroupTypeProvider,ChannelTypeProvider
@NonNullByDefault
public abstract class AbstractStorageBasedTypeProvider
extends Object
implements ThingTypeProvider, ChannelTypeProvider, ChannelGroupTypeProvider
The
AbstractStorageBasedTypeProvider is the base class for the implementation of a Storage based
ThingTypeProvider, ChannelTypeProvider and ChannelGroupTypeProvider
It can be subclassed by bindings that create ThingTypes and ChannelTypes on-the-fly and need to
persist those for future thing initializations- Author:
- Jan N. Klug - Initial contribution, Andrew Fiddian-Green - Added semanticEquipmentTag
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStorageBasedTypeProvider(StorageService storageService) Instantiate a new storage based type provider. -
Method Summary
Modifier and TypeMethodDescription@Nullable ChannelGroupTypegetChannelGroupType(ChannelGroupTypeUID channelGroupTypeUID, @Nullable Locale locale) getChannelGroupTypes(@Nullable Locale locale) @Nullable ChannelTypegetChannelType(ChannelTypeUID channelTypeUID, @Nullable Locale locale) getChannelTypes(@Nullable Locale locale) @Nullable ThingTypegetThingType(ThingTypeUID thingTypeUID, @Nullable Locale locale) Provides a thing type for the given UID or null if no type for the given UID exists.getThingTypes(@Nullable Locale locale) Provides a collection of thing typesvoidputChannelGroupType(ChannelGroupType channelGroupType) Add or update aChannelGroupTypeto the storagevoidputChannelType(ChannelType channelType) Add or update aChannelTypeto the storagevoidputThingType(ThingType thingType) Add or update aThingTypeto the storagevoidremoveChannelGroupType(ChannelGroupTypeUID channelGroupTypeUID) Remove aChannelGroupTypefrom the storagevoidremoveChannelType(ChannelTypeUID channelTypeUID) Remove aChannelTypefrom the storagevoidremoveThingType(ThingTypeUID thingTypeUID) Remove aThingTypefrom the storage
-
Constructor Details
-
AbstractStorageBasedTypeProvider
Instantiate a new storage based type provider. The subclass needs to be aComponentand declare itself asThingTypeProviderand/orChannelTypeProviderand/orChannelGroupTypeProvider.- Parameters:
storageService- a persistentStorageService
-
-
Method Details
-
putThingType
Add or update aThingTypeto the storage- Parameters:
thingType- theThingTypethat needs to be stored
-
removeThingType
Remove aThingTypefrom the storage- Parameters:
thingTypeUID- theThingTypeUIDof the thing type
-
putChannelType
Add or update aChannelTypeto the storage- Parameters:
channelType- theChannelTypethat needs to be stored
-
removeChannelType
Remove aChannelTypefrom the storage- Parameters:
channelTypeUID- theChannelTypeUIDof the channel type
-
putChannelGroupType
Add or update aChannelGroupTypeto the storage- Parameters:
channelGroupType- theChannelTypethat needs to be stored
-
removeChannelGroupType
Remove aChannelGroupTypefrom the storage- Parameters:
channelGroupTypeUID- theChannelGroupTypeUIDof the channel type
-
getThingTypes
Description copied from interface:ThingTypeProviderProvides a collection of thing types- Specified by:
getThingTypesin interfaceThingTypeProvider- Parameters:
locale- locale (can be null)- Returns:
- the thing types provided by the
ThingTypeProvider
-
getThingType
Description copied from interface:ThingTypeProviderProvides a thing type for the given UID or null if no type for the given UID exists.- Specified by:
getThingTypein interfaceThingTypeProvider- Parameters:
locale- locale (can be null)- Returns:
- thing type for the given UID or null if no type for the given UID exists
-
getChannelTypes
- Specified by:
getChannelTypesin interfaceChannelTypeProvider- See Also:
-
getChannelType
- Specified by:
getChannelTypein interfaceChannelTypeProvider- See Also:
-
getChannelGroupTypes
- Specified by:
getChannelGroupTypesin interfaceChannelGroupTypeProvider- See Also:
-
getChannelGroupType
public @Nullable ChannelGroupType getChannelGroupType(ChannelGroupTypeUID channelGroupTypeUID, @Nullable Locale locale) - Specified by:
getChannelGroupTypein interfaceChannelGroupTypeProvider- See Also:
-