java.lang.Object
org.openhab.core.common.registry.AbstractProvider<Item>
org.openhab.core.automation.module.script.providersupport.shared.ScriptedItemProvider
All Implemented Interfaces:
ManagedProvider<Item,String>, Provider<Item>, ItemProvider

@NonNullByDefault public class ScriptedItemProvider extends AbstractProvider<Item> implements ItemProvider, ManagedProvider<Item,String>
This ItemProvider keeps items provided by scripts during runtime. This ensures that items are not kept on reboot, but have to be provided by the scripts again.
Author:
Florian Hotze - Initial contribution
  • Constructor Details

    • ScriptedItemProvider

      public ScriptedItemProvider()
  • Method Details

    • getAll

      public Collection<Item> getAll()
      Description copied from interface: Provider
      Returns a collection of all elements.
      Specified by:
      getAll in interface Provider<Item>
      Returns:
      collection of all elements
    • get

      public @Nullable Item get(String itemName)
      Description copied from interface: ManagedProvider
      Returns an element for the given key or null if no element for the given key exists.
      Specified by:
      get in interface ManagedProvider<Item,String>
      Parameters:
      itemName - key
      Returns:
      returns element or null, if no element for the given key exists
    • add

      public void add(Item item)
      Description copied from interface: ManagedProvider
      Adds an element.
      Specified by:
      add in interface ManagedProvider<Item,String>
      Parameters:
      item - element to be added
    • update

      public @Nullable Item update(Item item)
      Description copied from interface: ManagedProvider
      Updates an element.
      Specified by:
      update in interface ManagedProvider<Item,String>
      Parameters:
      item - element to be updated
      Returns:
      returns the old element or null if no element with the same key exists
    • remove

      public @Nullable Item remove(String itemName)
      Description copied from interface: ManagedProvider
      Removes an element and returns the removed element.
      Specified by:
      remove in interface ManagedProvider<Item,String>
      Parameters:
      itemName - key of the element that should be removed
      Returns:
      element that was removed, or null if no element with the given key exists