Package org.openhab.core.storage
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 Summary
Modifier and TypeMethodDescription<T> Storage<T> getStorage(String name) Returns theStoragewith the givenname.<T> Storage<T> getStorage(String name, @Nullable ClassLoader classLoader)
-
Method Details
-
getStorage
Returns theStoragewith the givenname. If noStoragewith this name exists a new initialized instance is returned.- Parameters:
name- the name of theStorageServiceto return- Returns:
- a ready to use
Storage, nevernull
-
getStorage
Returns theStoragewith the givennameand a givenClassLoader. If noStoragewith this name exists a new initialized instance is returned.- Type Parameters:
T- The type of the storage service- Parameters:
name- the name of theStorageServiceto returnclassLoader- the class loader which should be used by theStorage- Returns:
- a ready to use
Storage, nevernull
-