Module datarush.library
Class SerializableModelStorageHandler<T extends Serializable>
- java.lang.Object
-
- com.pervasive.datarush.ports.model.SerializableModelStorageHandler<T>
-
- Type Parameters:
T
- the model type
- All Implemented Interfaces:
ModelStorageHandler<T>
public final class SerializableModelStorageHandler<T extends Serializable> extends Object implements ModelStorageHandler<T>
ModelStorageHandler that supports persistence of any Java-serializable model object. This is convenient for models that are of a type that is already Java-serializable.
-
-
Constructor Summary
Constructors Constructor Description SerializableModelStorageHandler(Class<T> modelClass)
Creates a model storage handler that knows how to serialize the given class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<T>
getModelClass()
Returns the model's java classT
read(DataInputStream in)
Deserialize a model from an input stream.void
write(T model, DataOutputStream out)
Serialize a model to an output stream.
-
-
-
Method Detail
-
read
public final T read(DataInputStream in)
Description copied from interface:ModelStorageHandler
Deserialize a model from an input stream. This implementation should be symmetric with that ofModelStorageHandler.write(T, java.io.DataOutputStream)
.- Specified by:
read
in interfaceModelStorageHandler<T extends Serializable>
- Parameters:
in
- the input stream.- Returns:
- the model object
-
write
public final void write(T model, DataOutputStream out)
Description copied from interface:ModelStorageHandler
Serialize a model to an output stream. This implementation should be symmetric with that ofModelStorageHandler.read(java.io.DataInputStream)
.- Specified by:
write
in interfaceModelStorageHandler<T extends Serializable>
- Parameters:
model
- the model objectout
- the output stream
-
getModelClass
public Class<T> getModelClass()
Description copied from interface:ModelStorageHandler
Returns the model's java class- Specified by:
getModelClass
in interfaceModelStorageHandler<T extends Serializable>
- Returns:
- the model's java class
-
-