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 classTread(DataInputStream in)Deserialize a model from an input stream.voidwrite(T model, DataOutputStream out)Serialize a model to an output stream.
-
-
-
Method Detail
-
read
public final T read(DataInputStream in)
Description copied from interface:ModelStorageHandlerDeserialize a model from an input stream. This implementation should be symmetric with that ofModelStorageHandler.write(T, java.io.DataOutputStream).- Specified by:
readin 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:ModelStorageHandlerSerialize a model to an output stream. This implementation should be symmetric with that ofModelStorageHandler.read(java.io.DataInputStream).- Specified by:
writein interfaceModelStorageHandler<T extends Serializable>- Parameters:
model- the model objectout- the output stream
-
getModelClass
public Class<T> getModelClass()
Description copied from interface:ModelStorageHandlerReturns the model's java class- Specified by:
getModelClassin interfaceModelStorageHandler<T extends Serializable>- Returns:
- the model's java class
-
-