Interface ObjectDataWriter<T>

  • Type Parameters:
    T - the type of the object to write
    All Known Implementing Classes:
    OutputStreamObjectDataWriter, RestObjectDataWriterAndRemover

    public interface ObjectDataWriter<T>
    An ObjectDataWriter is an entity that has the ability to write an object. The actual source and method that are used for writing the object is completely up to the implementation. The most common scenario is that the writer converts the object into serialized form by using an OutputConverter which than is passed into an OutputDataSource that is able to write the serialized data a certain source.
    • Method Detail

      • newGluonObservableObject

        GluonObservableObject<T> newGluonObservableObject()
        Provide an instance of a GluonObservableObject. This method is called by DataProvider.storeObject(Object, ObjectDataWriter) to get a GluonObservableObject that will contain the actual object when the store operation has completed successfully. Most implementations will just return an instance of GluonObservableObject itself. Note that it is perfectly valid to return existing instances of GluonObservableObject.
        an instance of a GluonObservableObject
      • writeObject

        Optional<T> writeObject​(T object)
                         throws IOException
        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 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.
        object - the object to write
        the object that will ultimately be set on the GluonObservableObject
        IOException - when an exception occurred during the write process