Class AbstractRegistry<K,​V>

  • All Implemented Interfaces:
    Registry<K,​V>
    Direct Known Subclasses:
    ElementsRegistryImpl

    public abstract class AbstractRegistry<K,​V>
    extends Object
    implements Registry<K,​V>
    Abstract class implementing Registry interface. In most cases, in order to introduce Registry implementation it is enough to inherit from this class.
    Since:
    2.1.0-SNAPSHOT
    Version:
    %I%, %G%
    Author:
    Piotr Dyraga
    See Also:
    Registry
    • Constructor Detail

      • AbstractRegistry

        public AbstractRegistry()
    • Method Detail

      • lookup

        public V lookup​(K name)
        Lookups value bound under the given name. If no value is bound, then null is returned.
        Specified by:
        lookup in interface Registry<K,​V>
        Parameters:
        name - name under which value is bound
        Returns:
        found value or null if none bound
      • bind

        public void bind​(K name,
                         V value)
                  throws AlreadyBoundException
        Binds value under the given name.
        Specified by:
        bind in interface Registry<K,​V>
        Parameters:
        name - name under which value is going to be bound
        value - bound value
        Throws:
        AlreadyBoundException - thrown if the given name is already bound to some value
      • unbind

        public void unbind​(K name)
        Unbinds name and the associated value from the registry.
        Specified by:
        unbind in interface Registry<K,​V>
        Parameters:
        name - name to be unbound
      • listBound

        public Set<K> listBound()
        Lists names of all values bound.
        Specified by:
        listBound in interface Registry<K,​V>
        Returns:
        Set of all names registered; empty Set if registry is empty