Interface Storage<T>

  • All Known Subinterfaces:
    DeletableStorage<T>
    All Known Implementing Classes:
    VolatileStorage

    @NonNullByDefault
    public interface Storage<T>
    A Storage is the generic way to store key-value pairs in ESH. Each Storage implementation can store its data differently, e.g in-memory or in-database.
    Author:
    Thomas Eichstaedt-Engelen - Initial contribution, Kai Kreuzer - improved return values
    • Method Detail

      • put

        @Nullable T put​(String key,
                        @Nullable T value)
        Puts a key-value mapping into this Storage.
        Parameters:
        key - the key to add
        value - the value to add
        Returns:
        previous value for the key or null if no value was replaced
      • remove

        @Nullable T remove​(String key)
        Removes the specified mapping from this map.
        Parameters:
        key - the mapping to remove
        Returns:
        the removed value or null if no entry existed
      • containsKey

        boolean containsKey​(String key)
        Check if the storage contains a key.
        Parameters:
        key - the key
        Returns:
        true if the storage contains the key, otherwise false
      • get

        @Nullable T get​(String key)
        Gets the value mapped to the key specified.
        Parameters:
        key - the key
        Returns:
        the mapped value, null if no match
      • getKeys

        Collection<String> getKeys()
        Gets all keys of this Storage.
        Returns:
        the keys of this Storage
      • getValues

        Collection<@Nullable T> getValues()
        Gets all values of this Storage.
        Returns:
        the values of this Storage
      • stream

        default Stream<Map.Entry<String,​@Nullable T>> stream()
        Get all storage entries.
        Returns:
        a stream of all storage entries