Interface ManagedProvider<E extends Identifiable<K>,K>

Type Parameters:
E - type of the element
K - type of the element key
All Superinterfaces:
Provider<E>
All Known Subinterfaces:
ManagedMetadataProvider
All Known Implementing Classes:
AbstractManagedProvider, DefaultAbstractManagedProvider, ManagedItemChannelLinkProvider, ManagedItemProvider, ManagedPersistenceServiceConfigurationProvider, ManagedRuleProvider, ManagedSemanticTagProvider, ManagedThingProvider, ManagedTransformationProvider, ScriptedRuleProvider

@NonNullByDefault public interface ManagedProvider<@NonNull E extends Identifiable<@NonNull K>,@NonNull K> extends Provider<E>
The ManagedProvider is a specific Provider that enables to add, remove and update elements at runtime.
Author:
Dennis Nobel - Initial contribution
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(@NonNull E element)
    Adds an element.
    @Nullable E
    get(@NonNull K key)
    Returns an element for the given key or null if no element for the given key exists.
    @Nullable E
    remove(@NonNull K key)
    Removes an element and returns the removed element.
    @Nullable E
    update(@NonNull E element)
    Updates an element.

    Methods inherited from interface org.openhab.core.common.registry.Provider

    addProviderChangeListener, getAll, removeProviderChangeListener
  • Method Details

    • add

      void add(@NonNull E element)
      Adds an element.
      Parameters:
      element - element to be added
    • remove

      @Nullable E remove(@NonNull K key)
      Removes an element and returns the removed element.
      Parameters:
      key - key of the element that should be removed
      Returns:
      element that was removed, or null if no element with the given key exists
    • update

      @Nullable E update(@NonNull E element)
      Updates an element.
      Parameters:
      element - element to be updated
      Returns:
      returns the old element or null if no element with the same key exists
    • get

      @Nullable E get(@NonNull K key)
      Returns an element for the given key or null if no element for the given key exists.
      Parameters:
      key - key
      Returns:
      returns element or null, if no element for the given key exists