-
- Type Parameters:
T
- the type of the object to write
- All Known Implementing Classes:
GluonCloudObjectDataWriterImpl
,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 anOutputConverter
which than is passed into anOutputDataSource
that is able to write the serialized data a certain source.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GluonObservableObject<T>
newGluonObservableObject()
Provide an instance of a GluonObservableObject.Optional<T>
writeObject(T object)
Writes the object and optionally returns one.
-
-
-
Method Detail
-
newGluonObservableObject
GluonObservableObject<T> newGluonObservableObject()
Provide an instance of a GluonObservableObject. This method is called byDataProvider.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.- Returns:
- 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 byDataProvider.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'snewGluonObservableObject()
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.- 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
-
-