Interface Registry<K,​V>

  • Type Parameters:
    K - the Registry key type
    V - the Registry value type
    All Superinterfaces:
    Directory<K,​V>
    All Known Implementing Classes:
    MapBackedRegistry

    public interface Registry<K,​V>
    extends Directory<K,​V>
    A read/write Registry that supports key and value types.
    Author:
    Carl Wilson
    • Method Detail

      • registerItem

        V registerItem​(K key,
                       V value)
        Add a single item to the Registry
        Parameters:
        key - the lookup key for the value to add
        value - the value to add
        Returns:
        the added value
      • registerItems

        void registerItems​(Map<K,​V> itemMap)
        Add a Map of items to the Registry
        Parameters:
        itemMap -
      • removeItem

        V removeItem​(K key)
        Unregister an item from the Registry.
        Parameters:
        key - the lookup key for the value to unregister.
        Returns:
        the removed value or null if no value was associated with the key
      • removeItems

        void removeItems​(Set<K> keys)
        Unregister a Set of items from the Registry.
        Parameters:
        keys - the Set of lookup keys to remove.
      • putdateItem

        V putdateItem​(K key,
                      V value)
        Registers or updates an item in Registry caring not if the item already exists.
        Parameters:
        key - the lookup key of the value to putdate.
        value - the value to be used for the putdate.
        Returns:
        the old value of the item
      • putdateItems

        void putdateItems​(Map<K,​V> itemMap)
        Registers or updates all item in Registry caring not if the items already exist or not.
        Parameters:
        itemMap - a Map of keys & values to add.
      • updateItem

        V updateItem​(K key,
                     V value)
        Updates the value associated with the key and throws and exception if the item isn't registered.
        Parameters:
        key - the lookup key of the value to update
        value - the value used in the update
        Returns:
        the old value of the item
        Throws:
        NoSuchElementException - if no value is associated with the key
      • updateItems

        void updateItems​(Map<K,​V> itemMap)
        Parameters:
        itemMap -
        Throws:
        NoSuchElementException - if no value is associated with one of the keys