public class StorageService extends CharmService
gluonClient| Constructor and Description |
|---|
StorageService(GluonClient gluonClient)
Construct a new StorageService.
|
| Modifier and Type | Method and Description |
|---|---|
StorageService |
authentication(Authentication authentication)
Defines which authentication method must be used when retrieving data
from Gluon Cloud.
|
<T> RemoteObservableList<T> |
retrieveList(java.lang.String id,
java.lang.Class<T> objectClass)
Retrieve the list with the provided id.
|
<T> RemoteObservableList<T> |
retrieveList(java.lang.String id,
java.lang.Class<T> objectClass,
SyncFlag... flags)
Retrieve the list with the provided id, using the provided flags to
decide how the list will be synchronized with Gluon Cloud.
|
<T> void |
retrieveObject(java.lang.String id,
java.lang.Class<T> objectClass,
java.util.function.BiConsumer<javafx.concurrent.Worker.State,T> consumer)
Retrieve the object with the provided id.
|
<T> void |
storeObject(java.lang.String id,
T object)
Store the provided object with the given id.
|
getGluonClientpublic StorageService(GluonClient gluonClient)
gluonClient - The GluonClient instance used to connect with Gluon
Cloud.public StorageService authentication(Authentication authentication)
authentication - The authentication method to use.public <T> RemoteObservableList<T> retrieveList(java.lang.String id, java.lang.Class<T> objectClass)
RemoteObservableList instance will be synchronized to Gluon
Cloud. Use retrieveList(java.lang.String, java.lang.Class, com.gluonhq.charm.connect.service.SyncFlag...)
in case other synchronization parameters need to be specified.T - The type of the elements that are contained in the list.id - The id of the list.objectClass - The class of the elements in the list.public <T> RemoteObservableList<T> retrieveList(java.lang.String id, java.lang.Class<T> objectClass, SyncFlag... flags)
T - The type of the elements that are contained in the list.id - The id of the list.objectClass - The class of the elements in the list.flags - define how changes between the local and remote list are
reflected to each other.public <T> void storeObject(java.lang.String id,
T object)
T - The type of the object.id - The id of the object.object - The actual object to store.public <T> void retrieveObject(java.lang.String id,
java.lang.Class<T> objectClass,
java.util.function.BiConsumer<javafx.concurrent.Worker.State,T> consumer)
Worker. The
provided consumer will be called whenever the state of the
background worker changes. When the state is equal to
SUCCEEDED, it is safe to
process the second parameter of the consumer as well. Please note, that
it's still possible that the second parameter will be null,
for instance when no object with the provided id exists.T - The type of the object to retrieve.id - The id of the object to retrieve.objectClass - The class of the object to retrieve.consumer - BiConsumer function that will be called whenever the
state of the background worker changes.