Package org.openhab.core.common.registry
Class AbstractProvider<E>
java.lang.Object
org.openhab.core.common.registry.AbstractProvider<E>
- Type Parameters:
E
- type of the provided elements
- All Implemented Interfaces:
Provider<E>
- Direct Known Subclasses:
AbstractManagedProvider
,ScriptedRuleProvider
@NonNullByDefault
public abstract class AbstractProvider<@NonNull E>
extends Object
implements Provider<E>
AbstractProvider
can be used as base class for Provider
implementations. It supports the registration
and notification of listeners.- Author:
- Dennis Nobel - Initial contribution
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addProviderChangeListener
(ProviderChangeListener<@NonNull E> listener) Adds aProviderChangeListener
which must be notified if there are changes concerning the elements provided by theProvider
.protected void
notifyListenersAboutAddedElement
(@NonNull E element) protected void
notifyListenersAboutRemovedElement
(@NonNull E element) protected void
notifyListenersAboutUpdatedElement
(@NonNull E oldElement, @NonNull E element) void
removeProviderChangeListener
(ProviderChangeListener<@NonNull E> listener) Removes aProviderChangeListener
.
-
Field Details
-
listeners
-
-
Constructor Details
-
AbstractProvider
public AbstractProvider()
-
-
Method Details
-
addProviderChangeListener
Description copied from interface:Provider
Adds aProviderChangeListener
which must be notified if there are changes concerning the elements provided by theProvider
.- Specified by:
addProviderChangeListener
in interfaceProvider<E>
- Parameters:
listener
- the listener to be added
-
removeProviderChangeListener
Description copied from interface:Provider
Removes aProviderChangeListener
.- Specified by:
removeProviderChangeListener
in interfaceProvider<E>
- Parameters:
listener
- the listener to be removed.
-
notifyListenersAboutAddedElement
-
notifyListenersAboutRemovedElement
-
notifyListenersAboutUpdatedElement
-