Interface StorageService

All Known Subinterfaces:
DeletableStorageService
All Known Implementing Classes:
VolatileStorageService

@NonNullByDefault public interface StorageService
The StorageService provides instances of Storages which are meant as a means for generic storage of key-value pairs. You can think of different StorageServices that store these key-value pairs differently. One can think of e.g in-memory or in-database Storages and many more. This StorageService decides which kind of Storage is returned on request. It is meant to be injected into service consumers with the need for storing generic key-value pairs like the ManagedXXXProviders.
Author:
Thomas Eichstaedt-Engelen - Initial contribution, Dennis Nobel - Added second method with ClassLoader
  • Method Details

    • getStorage

      <T> Storage<T> getStorage(String name)
      Returns the Storage with the given name. If no Storage with this name exists a new initialized instance is returned.
      Parameters:
      name - the name of the StorageService to return
      Returns:
      a ready to use Storage, never null
    • getStorage

      <T> Storage<T> getStorage(String name, @Nullable ClassLoader classLoader)
      Returns the Storage with the given name and a given ClassLoader. If no Storage with this name exists a new initialized instance is returned.
      Type Parameters:
      T - The type of the storage service
      Parameters:
      name - the name of the StorageService to return
      classLoader - the class loader which should be used by the Storage
      Returns:
      a ready to use Storage, never null