public class DataClient
extends java.lang.Object
The DataClient is the access point to the
 Gluon CloudLink Data Storage service.
 It assists in using the DataProvider with data stored on Gluon CloudLink as the data source. For instance,
 to retrieve a list from Gluon CloudLink, you can use the following code:
     DataClient dataClient = DataClientBuilder.create().build();
     GluonObservableList<Item> items = DataProvider.retrieveList(dataClient.createListDataReader("items", Item.class));
 
 Note: data will be always be stored in the private storage location for the application on the device. As
 a result, the DataClient depends on the StorageService, so make sure that the
 storage plugin has been enabled in your Gluon Mobile application build configuration:
     jfxmobile {
         downConfig {
             plugins = 'storage', ...
         }
     }
 | Modifier and Type | Method and Description | 
|---|---|
| <E> ListDataReader<E> | createListDataReader(java.lang.String identifier,
                    java.lang.Class<E> objectClass)Creates an instance of  ListDataReaderthat can be passed directly in theDataProvider.retrieveList(ListDataReader)method. | 
| <E> ListDataReader<E> | createListDataReader(java.lang.String identifier,
                    java.lang.Class<E> objectClass,
                    SyncFlag... syncFlags)Creates an instance of  ListDataReaderthat can be passed directly in theDataProvider.retrieveList(ListDataReader)method. | 
| <T> ObjectDataReader<T> | createObjectDataReader(java.lang.String identifier,
                      java.lang.Class<T> objectClass,
                      SyncFlag... syncFlags)Creates an instance of  ObjectDataReaderthat can be passed directly in theDataProvider.retrieveObject(ObjectDataReader)method. | 
| <T> ObjectDataRemover<T> | createObjectDataRemover()Creates an instance of  ObjectDataRemoverthat can be passed directly in theDataProvider.removeObject(GluonObservableObject, ObjectDataRemover)method. | 
| <T> ObjectDataWriter<T> | createObjectDataWriter(java.lang.String identifier,
                      java.lang.Class<T> objectClass,
                      SyncFlag... syncFlags)Creates an instance of  ObjectDataWriterthat can be passed directly in theDataProvider.storeObject(Object, ObjectDataWriter)method. | 
| OperationMode | getOperationMode()Get the operation mode to use when storing or retrieving data with this DataClient instance. | 
| <E> void | push(GluonObservableList<E> list)Push any changes made to the list. | 
| <E> void | push(GluonObservableList<E> list,
    boolean fully)Push any changes made to the list. | 
| <T> void | push(GluonObservableObject<T> object)Push any changes made to the object. | 
public OperationMode getOperationMode()
public <T> ObjectDataReader<T> createObjectDataReader(java.lang.String identifier, java.lang.Class<T> objectClass, SyncFlag... syncFlags)
ObjectDataReader that can be passed directly in the
 DataProvider.retrieveObject(ObjectDataReader) method. The object data reader will read the object with
 the specified identifier.
 Any of the following synchronization flags can be passed in with the syncFlags parameter:
 SyncFlag.OBJECT_READ_THROUGH and SyncFlag.OBJECT_WRITE_THROUGH. All other flags will be silently
 ignored.
T - the type of the object that is retrievedidentifier - the identifier of the object to retrieveobjectClass - the class of the object to retrievesyncFlags - an optional list of synchronization flagspublic <T> ObjectDataWriter<T> createObjectDataWriter(java.lang.String identifier, java.lang.Class<T> objectClass, SyncFlag... syncFlags)
ObjectDataWriter that can be passed directly in the
 DataProvider.storeObject(Object, ObjectDataWriter) method. The object data writer will write the object
 with the specified identifier.
 Any of the following synchronization flags can be passed in with the syncFlags parameter:
 SyncFlag.OBJECT_READ_THROUGH and SyncFlag.OBJECT_WRITE_THROUGH. All other flags will be silently
 ignored.
T - the type of the object that is storedidentifier - the identifier of the object to storeobjectClass - the class of the object to storesyncFlags - an optional list of synchronization flagspublic <T> ObjectDataRemover<T> createObjectDataRemover()
ObjectDataRemover that can be passed directly in the
 DataProvider.removeObject(GluonObservableObject, ObjectDataRemover) method. The observable object that is
 passed in with the removeObject method will be used to get the identifier of the object that needs to be removed.
 Note: this method can only be used for removing observable objects that were either retrieved using an ObjectDataReader created by a DataClient instance or stored using an ObjectDataWriter created by a DataClient instance.
T - the type of the object to removepublic <E> ListDataReader<E> createListDataReader(java.lang.String identifier, java.lang.Class<E> objectClass)
ListDataReader that can be passed directly in the
 DataProvider.retrieveList(ListDataReader) method. This method is the same as calling
 createListDataReader(String, Class, SyncFlag...) with the following two synchronization flags:
 SyncFlag.LIST_READ_THROUGH and SyncFlag.LIST_WRITE_THROUGH.E - the type of the objects contained in the list to readidentifier - the identifier of the list to retrieveobjectClass - the class of the objects contained in the list to readpublic <E> ListDataReader<E> createListDataReader(java.lang.String identifier, java.lang.Class<E> objectClass, SyncFlag... syncFlags)
ListDataReader that can be passed directly in the
 DataProvider.retrieveList(ListDataReader) method. The list data reader will read the list with the
 specified identifier together with the objects it contains.E - the type of the objects contained in the list to readidentifier - the identifier of the list to retrieveobjectClass - the class of the objects contained in the list to readsyncFlags - an optional list of synchronization flagspublic <E> void push(GluonObservableList<E> list)
push(GluonObservableList, boolean) with a value of true for the fully
 parameter.E - the type of the objects contained in the list to pushlist - the observable list to pushpush(GluonObservableList, boolean)public <E> void push(GluonObservableList<E> list, boolean fully)
When the fully parameter is set to true, all items in the list will be considered as
 marked for update. Otherwise, only items that were removed or added or updated manually will be pushed. Again,
 note that when using fully with a value of true, items that were marked for removal
 will still be removed because the removal marker takes precedence over the update marker.
E - the type of the objects contained in the list to pushlist - the observable list to pushfully - when true all items in the list are considered as marked for updatepublic <T> void push(GluonObservableObject<T> object)
write through flag.
 A push can be used as a convenient way to store updates to an observable object that was already retrieved. Consider the following code, to see an example of the push method:
     GluonObservableObject<Sample> sample = DataProvider.retrieveObject(dataClient.createObjectDataReader("sample", Sample.class));
     // somewhere the object gets updated and you want to store the updates
     dataClient.push(sample);
 
 Actually, the push method is a simple alternative to the storeObject
 method that is available in DataProvider. Using that method, updating the object can be done as follows, which
 is more cumbersome to write and you need to pass in the object identifier again:
     DataProvider.storeObject(sample.get(), dataClient.createObjectDataWriter("sample", Sample.class));
 
 Note: this method can only be used with observable objects that were either retrieved using an ObjectDataReader created by a DataClient instance or stored using an ObjectDataWriter created by a DataClient instance.
T - the type of the object to pushobject - the observable object to push