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 ThingType
s and ChannelType
s on-the-fly and need to
persist those for future thing initializations- Author:
- Jan N. Klug - Initial contribution
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractStorageBasedTypeProvider
(StorageService storageService) Instantiate a new storage based type provider. -
Method Summary
Modifier and TypeMethodDescription@Nullable ChannelGroupType
getChannelGroupType
(ChannelGroupTypeUID channelGroupTypeUID, @Nullable Locale locale) getChannelGroupTypes
(@Nullable Locale locale) @Nullable ChannelType
getChannelType
(ChannelTypeUID channelTypeUID, @Nullable Locale locale) getChannelTypes
(@Nullable Locale locale) @Nullable ThingType
getThingType
(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 typesvoid
putChannelGroupType
(ChannelGroupType channelGroupType) Add or update aChannelGroupType
to the storagevoid
putChannelType
(ChannelType channelType) Add or update aChannelType
to the storagevoid
putThingType
(ThingType thingType) Add or update aThingType
to the storagevoid
removeChannelGroupType
(ChannelGroupTypeUID channelGroupTypeUID) Remove aChannelGroupType
from the storagevoid
removeChannelType
(ChannelTypeUID channelTypeUID) Remove aChannelType
from the storagevoid
removeThingType
(ThingTypeUID thingTypeUID) Remove aThingType
from the storage
-
Constructor Details
-
AbstractStorageBasedTypeProvider
Instantiate a new storage based type provider. The subclass needs to be aComponent
and declare itself asThingTypeProvider
and/orChannelTypeProvider
and/orChannelGroupTypeProvider
.- Parameters:
storageService
- a persistentStorageService
-
-
Method Details
-
putThingType
Add or update aThingType
to the storage- Parameters:
thingType
- theThingType
that needs to be stored
-
removeThingType
Remove aThingType
from the storage- Parameters:
thingTypeUID
- theThingTypeUID
of the thing type
-
putChannelType
Add or update aChannelType
to the storage- Parameters:
channelType
- theChannelType
that needs to be stored
-
removeChannelType
Remove aChannelType
from the storage- Parameters:
channelTypeUID
- theChannelTypeUID
of the channel type
-
putChannelGroupType
Add or update aChannelGroupType
to the storage- Parameters:
channelGroupType
- theChannelType
that needs to be stored
-
removeChannelGroupType
Remove aChannelGroupType
from the storage- Parameters:
channelGroupTypeUID
- theChannelGroupTypeUID
of the channel type
-
getThingTypes
Description copied from interface:ThingTypeProvider
Provides a collection of thing types- Specified by:
getThingTypes
in interfaceThingTypeProvider
- Parameters:
locale
- locale (can be null)- Returns:
- the thing types provided by the
ThingTypeProvider
-
getThingType
Description copied from interface:ThingTypeProvider
Provides a thing type for the given UID or null if no type for the given UID exists.- Specified by:
getThingType
in interfaceThingTypeProvider
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:
getChannelTypes
in interfaceChannelTypeProvider
- See Also:
-
getChannelType
- Specified by:
getChannelType
in interfaceChannelTypeProvider
- See Also:
-
getChannelGroupTypes
- Specified by:
getChannelGroupTypes
in interfaceChannelGroupTypeProvider
- See Also:
-
getChannelGroupType
public @Nullable ChannelGroupType getChannelGroupType(ChannelGroupTypeUID channelGroupTypeUID, @Nullable Locale locale) - Specified by:
getChannelGroupType
in interfaceChannelGroupTypeProvider
- See Also:
-