Class RestObjectDataWriterAndRemover<T>

    • Method Detail

      • writeObject

        public Optional<T> writeObject​(T object)
                                throws IOException
        Description copied from interface: ObjectDataWriter
        Writes the object and optionally returns one. The actual method that converts the object into serialized data and the source where this data is written to is completely left to the implementation. This method is called by DataProvider.storeObject(Object, ObjectDataWriter) to initiate the actual write process. The returned object will be set on the final GluonObservableObject that is provided by this writer's ObjectDataWriter.newGluonObservableObject() method. The returned object can be the same as the provided object or it can be a completely new object. An empty Optional can be returned as well, which is the same as returning the provided object.
        Specified by:
        writeObject in interface ObjectDataWriter<T>
        Parameters:
        object - the object to write
        Returns:
        the object that will ultimately be set on the GluonObservableObject
        Throws:
        IOException - when an exception occurred during the write process
      • removeObject

        public Optional<T> removeObject​(GluonObservableObject<T> observable)
                                 throws IOException
        Description copied from interface: ObjectDataRemover
        Removes the object and optionally returns an object. The actual method that removes the object is completely left to the implementation. This method is called by DataProvider.removeObject(GluonObservableObject, ObjectDataRemover) to initiate the actual removal process. If this method returns a non-empty Optional, the object that is contained in the Optional will be set on the provided observable object. Otherwise, the value of the observable object will be set to null. When the remove operation completed successfully, the state of the provided observable will be set to ConnectState.REMOVED.
        Specified by:
        removeObject in interface ObjectDataRemover<T>
        Parameters:
        observable - the observable object that needs to be removed
        Returns:
        an optional containing an object that will ultimately be set on the provided GluonObservableObject
        Throws:
        IOException - when an exception occurred during the removal process