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
ConstructorsConstructorDescriptionSerializableModelStorageHandler(Class<T> modelClass) Creates a model storage handler that knows how to serialize the given class -
Method Summary
Modifier and TypeMethodDescriptionReturns the model's java classfinal Tread(DataInputStream in) Deserialize a model from an input stream.final voidwrite(T model, DataOutputStream out) Serialize a model to an output stream.
-
Constructor Details
-
SerializableModelStorageHandler
Creates a model storage handler that knows how to serialize the given class- Parameters:
modelClass- the model class
-
-
Method Details
-
read
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
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
Description copied from interface:ModelStorageHandlerReturns the model's java class- Specified by:
getModelClassin interfaceModelStorageHandler<T extends Serializable>- Returns:
- the model's java class
-