Class AbstractLinkRegistry<L extends AbstractLink,​P extends Provider<L>>

    • Constructor Detail

      • AbstractLinkRegistry

        protected AbstractLinkRegistry​(Class<P> providerClazz)
    • Method Detail

      • onAddElement

        protected void onAddElement​(L element)
        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 class AbstractRegistry<L extends AbstractLink,​String,​P extends Provider<L>>
        Parameters:
        element - element to be added
      • onRemoveElement

        protected void onRemoveElement​(L element)
        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 class AbstractRegistry<L extends AbstractLink,​String,​P extends Provider<L>>
        Parameters:
        element - element to be removed
      • onUpdateElement

        protected void onUpdateElement​(L oldElement,
                                       L element)
        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 class AbstractRegistry<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

        public boolean isLinked​(String itemName,
                                UID uid)
        Returns if an item for a given item name is linked to a channel or thing for a given UID.
        Parameters:
        itemName - item name
        uid - UID
        Returns:
        true if linked, false otherwise
      • isLinked

        public boolean isLinked​(String itemName)
        Returns if a link for the given item name exists.
        Parameters:
        itemName - item name
        Returns:
        true if a link exists, otherwise false
      • isLinked

        public boolean isLinked​(UID uid)
        Returns if a link for the given UID exists.
        Parameters:
        uid - UID
        Returns:
        true if a link exists, otherwise false
      • getLinkedItemNames

        public Set<String> getLinkedItemNames​(UID uid)
        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

        public Set<L> getLinks​(UID uid)
        Returns all links for a given UID.
        Parameters:
        uid - a channel UID
        Returns:
        an unmodifiable set of links for the given UID
      • getLinks

        public Set<L> getLinks​(String itemName)
        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