Interface Registry<E extends Identifiable<K>,​K>

    • Method Detail

      • getAll

        Collection<E> getAll()
        Returns a collection of all elements in the registry.
        Returns:
        collection of all elements in the registry
      • stream

        Stream<E> stream()
        Returns a stream of all elements in the registry.
        Returns:
        stream of all elements in the registry
      • get

        @Nullable E get​(K key)
        This method retrieves a single element from the registry.
        Parameters:
        key - key of the element
        Returns:
        element or null if no element was found
      • add

        E add​(E element)
        Adds the given element to the according ManagedProvider.
        Parameters:
        element - element to be added (must not be null)
        Returns:
        the added element or newly created object of the same type
        Throws:
        IllegalStateException - if no ManagedProvider is available
      • update

        @Nullable E update​(E element)
        Updates the given element at the according ManagedProvider.
        Parameters:
        element - element to be updated (must not be null)
        Returns:
        returns the old element or null if no element with the same key exists
        Throws:
        IllegalStateException - if no ManagedProvider is available
      • remove

        @Nullable E remove​(K key)
        Removes the given element from the according ManagedProvider.
        Parameters:
        key - key of the element (must not be null)
        Returns:
        element that was removed, or null if no element with the given key exists
        Throws:
        IllegalStateException - if no ManagedProvider is available