Class DataProvider


  • public class DataProvider
    extends Object
    The DataProvider is the root entry to obtain instances of GluonObservableObject and GluonObservableList. All operations on the DataProvider happen in an asynchronous background thread. You can use the properties on the GluonObservable entity to get information about the progress of the operation.
    • Constructor Detail

      • DataProvider

        public DataProvider()
    • Method Detail

      • storeObject

        public static <T> GluonObservableObject<T> storeObject​(T object,
                                                               ObjectDataWriter<T> writer)
        Writes the object by using the specified ObjectDataWriter. A GluonObservableObject is returned, that will contain the written version of the provided object when the write operation completed successfully.
        Type Parameters:
        T - the type of the object to store
        Parameters:
        object - the object to store
        writer - the writer to use for storing the object
        Returns:
        an instance of GluonObservableObject that will hold the written version of the provided object upon successful completion of the write operation
      • retrieveObject

        public static <T> GluonObservableObject<T> retrieveObject​(ObjectDataReader<T> reader)
        Retrieves an object using the specified ObjectDataReader. A GluonObservableObject is returned, that will contain the object when the read operation completed successfully.
        Type Parameters:
        T - the type of the object to retrieve
        Parameters:
        reader - the reader to use for retrieving the object
        Returns:
        an instance of GluonObservableObject that will hold the retrieved object upon successful completion of the read operation
      • removeObject

        public static <T> void removeObject​(GluonObservableObject<T> observable,
                                            ObjectDataRemover<T> remover)
        Remove the provided GluonObservableObject using the specified ObjectDataRemover. The state of the provided observable will be updated to ConnectState.REMOVED and the contained object will be set to null when the remove operation completed successfully.
        Type Parameters:
        T - the type of the object that is contained in the GluonObservableObject
        Parameters:
        observable - the observable to remove
        remover - the remover to use for removing the object
      • retrieveList

        public static <E> GluonObservableList<E> retrieveList​(ListDataReader<E> reader)
        Retrieves a list using the specified ListDataReader. A GluonObservableList is returned, containing all the items that exist in the list. The returned list can be used immediately: you can manipulate its items or assign it to a JavaFX ListView for instance.
        Type Parameters:
        E - the type of the objects inside the list
        Parameters:
        reader - the reader to use for retrieving the list
        Returns:
        an instance of GluonObservableList that will hold the items contained in the list upon successful completion of the read operation