Package org.openhab.core.thing.link
Class AbstractLinkRegistry<L extends AbstractLink,P extends Provider<L>>
java.lang.Object
org.openhab.core.common.registry.AbstractRegistry<L,String,P>
org.openhab.core.thing.link.AbstractLinkRegistry<L,P>
- Type Parameters:
L
- Concrete type of the abstract link
- All Implemented Interfaces:
ProviderChangeListener<L>
,Registry<L,
String>
- Direct Known Subclasses:
ItemChannelLinkRegistry
@NonNullByDefault
public abstract class AbstractLinkRegistry<L extends AbstractLink,P extends Provider<L>>
extends AbstractRegistry<L,String,P>
AbstractLinkRegistry
is an abstract class for link based registries,
which handle AbstractLink
s.- Author:
- Dennis Nobel - Initial contribution, Markus Rathgeb - Use separate collections to improve performance
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetLinkedItemNames
(UID uid) Returns the item names, which are bound to the given UID.Returns all links for a given item name.Returns all links for a given UID.boolean
Returns if a link for the given item name exists.boolean
Returns if an item for a given item name is linked to a channel or thing for a given UID.boolean
Returns if a link for the given UID exists.protected void
onAddElement
(L element) This method is called before an element is added.protected void
onRemoveElement
(L element) This method is called before an element is removed.protected void
onUpdateElement
(L oldElement, L element) This method is called before an element is updated.Methods inherited from class org.openhab.core.common.registry.AbstractRegistry
activate, add, added, addProvider, addRegistryChangeListener, beforeUpdateElement, deactivate, forEach, forEach, forEach, get, getAll, getEventPublisher, getManagedProvider, getProvider, getProvider, getValueAndProvider, notifyListeners, notifyListeners, notifyListenersAboutAddedElement, notifyListenersAboutRemovedElement, notifyListenersAboutUpdatedElement, postEvent, remove, removed, removeProvider, removeRegistryChangeListener, setEventPublisher, setManagedProvider, setReadyService, stream, unsetEventPublisher, unsetManagedProvider, unsetReadyService, update, updated, waitForCompletedAsyncActivationTasks
-
Constructor Details
-
AbstractLinkRegistry
-
-
Method Details
-
onAddElement
Description copied from class:AbstractRegistry
This method is called before an element is added. The implementing class can override this method to perform initialization logic or check the validity of the element.To keep custom logic on the inheritance chain, you must call always the super implementation first.
If the method throws an
IllegalArgumentException
the element will not be added.- Overrides:
onAddElement
in classAbstractRegistry<L extends AbstractLink,
String, P extends Provider<L>> - Parameters:
element
- element to be added
-
onRemoveElement
Description copied from class:AbstractRegistry
This method is called before an element is removed. The implementing class can override this method to perform specific logic.To keep custom logic on the inheritance chain, you must call always the super implementation first.
- Overrides:
onRemoveElement
in classAbstractRegistry<L extends AbstractLink,
String, P extends Provider<L>> - Parameters:
element
- element to be removed
-
onUpdateElement
Description copied from class:AbstractRegistry
This method is called before an element is updated. The implementing class can override this method to perform specific logic or check the validity of the updated element.To keep custom logic on the inheritance chain, you must call always the super implementation first.
- Overrides:
onUpdateElement
in classAbstractRegistry<L extends AbstractLink,
String, P extends Provider<L>> - Parameters:
oldElement
- old element (before update, as given by the provider)element
- updated element (after update)If the method throws an
IllegalArgumentException
the element will not be updated.
-
isLinked
Returns if an item for a given item name is linked to a channel or thing for a given UID.- Parameters:
itemName
- item nameuid
- UID- Returns:
- true if linked, false otherwise
-
isLinked
Returns if a link for the given item name exists.- Parameters:
itemName
- item name- Returns:
- true if a link exists, otherwise false
-
isLinked
Returns if a link for the given UID exists.- Parameters:
uid
- UID- Returns:
- true if a link exists, otherwise false
-
getLinkedItemNames
Returns the item names, which are bound to the given UID.- Parameters:
uid
- UID- Returns:
- a non-null unmodifiable collection of item names that are linked to the given UID.
-
getLinks
Returns all links for a given UID.- Parameters:
uid
- a channel UID- Returns:
- an unmodifiable set of links for the given UID
-
getLinks
Returns all links for a given item name.- Parameters:
itemName
- the name of the item- Returns:
- an unmodifiable set of links for the given item name
-