J
JCM
I have a class ("PieChart") that subclasses JComponent (and by
extension, Container). In the constructor for my class, I call
"this.add(mChart.graph)", where mChart is a transient member variable
and mChart.grpah is not serializable. The problem comes when I try to
serialize the PieChart instance: I can't prevent Java from trying to
write mChart.graph to the output stream (and thereby throwing a
NotSerializableException). I've tried over-riding the writeObject
method with a blank one, as well as with one that calls
"this.remove(mChart.graph)", but to no avail: I don't have control
over how the superclass (Container in this case) handles writing
*it*self, and apparantly this happens before my overriding code is
even called.
I'd appreciate any suggestions on how to get around this; I just want
to be able to write the PieChart object to a file without mChart.graph
being written (indeed, mChart itself I can reconstruct trivially from
other arguments).
Thanks!
-Josh
extension, Container). In the constructor for my class, I call
"this.add(mChart.graph)", where mChart is a transient member variable
and mChart.grpah is not serializable. The problem comes when I try to
serialize the PieChart instance: I can't prevent Java from trying to
write mChart.graph to the output stream (and thereby throwing a
NotSerializableException). I've tried over-riding the writeObject
method with a blank one, as well as with one that calls
"this.remove(mChart.graph)", but to no avail: I don't have control
over how the superclass (Container in this case) handles writing
*it*self, and apparantly this happens before my overriding code is
even called.
I'd appreciate any suggestions on how to get around this; I just want
to be able to write the PieChart object to a file without mChart.graph
being written (indeed, mChart itself I can reconstruct trivially from
other arguments).
Thanks!
-Josh