I want to serialize an object in GWT, which inherits other kinds of objects within this code. My result should be an System.out.print
:
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import com.google.gwt.user.client.rpc.IsSerializable;
import spa.shared.storages.RouteStorage;
public class RouteStorageHelper implements IsSerializable {
public RouteStorageHelper() {
}
public void storeRoutes(RouteStorage routeStorage) {
ByteArrayOutputStream baos;
ObjectOutputStream out;
baos = new ByteArrayOutputStream();
try {
out = new ObjectOutputStream(baos);
out.writeObject(routeStorage);
//byte[] byteArray=baos.toByteArray();
out.close();
byte[] serializedGraph=baos.toByteArray();
System.out.println(serializedGraph);
} catch (Exception sqle) {
System.out.print(sqle);
}
}
But all i got, is a NotSerializableException
, which tells, something is not serialized. I can not understand, because other subclass-objects also got the IsSerializable
interface.
Other classes with this interface: RouteStorage, Storage, Patient, Employee
, etc...
Things i also use: String, Integer, HashMap, ArrayList, Date (java.util)
and two enums Status and Qualifikation
.
Is any of this Classes not serializable? Is there something different in GWT?