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 Storage
s which are
meant as a means for generic storage of key-value pairs. You can think of
different StorageService
s that store these key-value pairs
differently. One can think of e.g in-memory or in-database Storage
s
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 theStorage
with the givenname
.<T> Storage<T>
getStorage
(String name, @Nullable ClassLoader classLoader)
-
Method Details
-
getStorage
Returns theStorage
with the givenname
. If noStorage
with this name exists a new initialized instance is returned.- Parameters:
name
- the name of theStorageService
to return- Returns:
- a ready to use
Storage
, nevernull
-
getStorage
Returns theStorage
with the givenname
and a givenClassLoader
. If noStorage
with this name exists a new initialized instance is returned.- Type Parameters:
T
- The type of the storage service- Parameters:
name
- the name of theStorageService
to returnclassLoader
- the class loader which should be used by theStorage
- Returns:
- a ready to use
Storage
, nevernull
-