Class ScriptedThingProvider
java.lang.Object
org.openhab.core.common.registry.AbstractProvider<Thing>
org.openhab.core.automation.module.script.providersupport.shared.ScriptedThingProvider
- All Implemented Interfaces:
ManagedProvider<Thing,,ThingUID> Provider<Thing>,EventSubscriber,ThingProvider
@NonNullByDefault
public class ScriptedThingProvider
extends AbstractProvider<Thing>
implements ThingProvider, ManagedProvider<Thing,ThingUID>, EventSubscriber
This
ThingProvider keeps things provided by scripts during runtime.
This ensures that things are not kept on reboot, but have to be provided by the scripts again.- Author:
- Florian Hotze - Initial contribution
-
Field Summary
Fields inherited from class org.openhab.core.common.registry.AbstractProvider
listenersFields inherited from interface org.openhab.core.events.EventSubscriber
ALL_EVENT_TYPES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an element.@Nullable ThingReturns an element for the given key or null if no element for the given key exists.getAll()Returns a collection of all elements.Gets the event types to which the event subscriber is subscribed to.voidCallback method for receivingEvents from the openHAB event bus.@Nullable ThingRemoves an element and returns the removed element.@Nullable ThingUpdates an element.Methods inherited from class org.openhab.core.common.registry.AbstractProvider
addProviderChangeListener, notifyListenersAboutAddedElement, notifyListenersAboutRemovedElement, notifyListenersAboutUpdatedElement, removeProviderChangeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openhab.core.events.EventSubscriber
getEventFilterMethods inherited from interface org.openhab.core.common.registry.Provider
addProviderChangeListener, removeProviderChangeListener
-
Constructor Details
-
ScriptedThingProvider
public ScriptedThingProvider()
-
-
Method Details
-
getAll
Description copied from interface:ProviderReturns a collection of all elements. -
get
Description copied from interface:ManagedProviderReturns an element for the given key or null if no element for the given key exists.- Specified by:
getin interfaceManagedProvider<Thing,ThingUID> - Parameters:
uid- key- Returns:
- returns element or null, if no element for the given key exists
-
add
Description copied from interface:ManagedProviderAdds an element.- Specified by:
addin interfaceManagedProvider<Thing,ThingUID> - Parameters:
thing- element to be added
-
update
Description copied from interface:ManagedProviderUpdates an element.- Specified by:
updatein interfaceManagedProvider<Thing,ThingUID> - Parameters:
thing- element to be updated- Returns:
- returns the old element or null if no element with the same key exists
-
remove
Description copied from interface:ManagedProviderRemoves an element and returns the removed element.- Specified by:
removein interfaceManagedProvider<Thing,ThingUID> - Parameters:
uid- key of the element that should be removed- Returns:
- element that was removed, or null if no element with the given key exists
-
getSubscribedEventTypes
Description copied from interface:EventSubscriberGets the event types to which the event subscriber is subscribed to.- Specified by:
getSubscribedEventTypesin interfaceEventSubscriber- Returns:
- subscribed event types (not null)
-
receive
Description copied from interface:EventSubscriberCallback method for receivingEvents from the openHAB event bus. This method is called for every event where the event subscriber is subscribed to and the event filter applies.- Specified by:
receivein interfaceEventSubscriber- Parameters:
event- the received event (not null)
-