Class MapBackedRegistry<K,V>

java.lang.Object
org.verapdf.core.MapBackedDirectory<K,V>
org.verapdf.core.MapBackedRegistry<K,V>
Type Parameters:
K - A key or lookup type
V - A value type
All Implemented Interfaces:
Directory<K,V>, Registry<K,V>

public class MapBackedRegistry<K,V> extends MapBackedDirectory<K,V> implements Registry<K,V>
A Map backed Registry implementation.
Author:
Carl Wilson
  • Constructor Details

    • MapBackedRegistry

      public MapBackedRegistry()
      Creates an empty registry instance, initialised with an empty map
    • MapBackedRegistry

      public MapBackedRegistry(Map<K,V> map)
      Creates a registry instance initialise using the passed map
      Parameters:
      map - a Map<K, V> instance used to initialise the registry.
  • Method Details

    • registerItem

      public V registerItem(K key, V value)
      { @inheritDoc }
      Specified by:
      registerItem in interface Registry<K,V>
      Parameters:
      key - the lookup key for the value to add
      value - the value to add
      Returns:
      the added value
    • registerItems

      public void registerItems(Map<K,V> itemMap)
      { @inheritDoc }
      Specified by:
      registerItems in interface Registry<K,V>
    • removeItem

      public V removeItem(K key)
      { @inheritDoc }
      Specified by:
      removeItem in interface Registry<K,V>
      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

      public void removeItems(Set<K> keys)
      { @inheritDoc }
      Specified by:
      removeItems in interface Registry<K,V>
      Parameters:
      keys - the Set of lookup keys to remove.
    • putdateItem

      public V putdateItem(K key, V value)
      { @inheritDoc }
      Specified by:
      putdateItem in interface Registry<K,V>
      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

      public void putdateItems(Map<K,V> itemMap)
      { @inheritDoc }
      Specified by:
      putdateItems in interface Registry<K,V>
      Parameters:
      itemMap - a Map of keys & values to add.
    • updateItem

      public V updateItem(K key, V value)
      { @inheritDoc }
      Specified by:
      updateItem in interface Registry<K,V>
      Parameters:
      key - the lookup key of the value to update
      value - the value used in the update
      Returns:
      the old value of the item
    • updateItems

      public void updateItems(Map<K,V> itemMap)
      { @inheritDoc }
      Specified by:
      updateItems in interface Registry<K,V>