Class XRegistry<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      XRegistry()
      Instantiates a new registry.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract boolean areEqual​(T a, T b)
      Subclasses must implement this method.
      T currentDefault()
      Retrieves the current default instance.
      java.util.Set<T> getAvailable()
      Retrieves a set of all available instances.
      protected boolean isContained​(T instance)
      Checks whether the given instance is already contained in the registry.
      void register​(T instance)
      Registers a new instance with this registry.
      void setCurrentDefault​(T instance)
      Sets the current default instance of this registry.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XRegistry

        public XRegistry()
        Instantiates a new registry.
    • Method Detail

      • getAvailable

        public java.util.Set<T> getAvailable()
        Retrieves a set of all available instances.
      • currentDefault

        public T currentDefault()
        Retrieves the current default instance.
      • register

        public void register​(T instance)
        Registers a new instance with this registry.
        Parameters:
        instance - Instance to be registered.
      • setCurrentDefault

        public void setCurrentDefault​(T instance)
        Sets the current default instance of this registry.
        Parameters:
        instance - Instance to be the current default of this registry.
      • areEqual

        protected abstract boolean areEqual​(T a,
                                            T b)
        Subclasses must implement this method. It is used by the registry to ensure that no duplicates are inserted.
        Parameters:
        a - An instance a.
        b - Another instance b.
        Returns:
        Whether the instances a and b are equivalent.
      • isContained

        protected boolean isContained​(T instance)
        Checks whether the given instance is already contained in the registry.
        Parameters:
        instance - Instance to check against registry.
        Returns:
        Whether the given instance is already registered.