I\'m using Javafx, and I wrap my objects into ListProperty to let the tableview updates for any changes on the objects of the list. Now I\'m trying to serialize my project a
The property Object
needs to implement the Serializable
interface. Here is a simple extension of SimpleObjectProperty
, for generic objects, that is serializable:
public class WriteableObjectProperty extends SimpleObjectProperty implements Serializable {
public WriteableObjectProperty () {
super();
}
public WriteableObjectProperty (T obj) {
super(obj);
}
private void writeObject (ObjectOutputStream s) throws IOException {
s.defaultWriteObject();
s.writeObject(get());
}
private void readObject (ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
set((T) s.readObject());
}
}