Community
Participate
Working Groups
It is difficult to serialize hierarchies of Figures to XML because many primitive classes do not conform to basic javabeans requirements (they lack simple getter/setter pairs for fields). This could be easily fixed with liberal use of the "Generate Getter/Setters" command by someone with the ability to commit to CVS. To reproduce one example: import org.eclipse.draw2d.geometry.Rectangle import java.beans.XMLEncoder import java.beans.XMLDecoder import java.io.ByteArrayOutputStream import java.io.ByteArrayInputStream .... Rectangle inputRect = new Rectangle(50, 25, 100, 200); ByteArrayOutputStream temporaryStream = new ByteArrayOutputStream(); XMLEncoder encoder = new XMLEncoder(temporaryStream); encoder.writeObject(inputRect); encoder.close(); byte[] buffer = temporaryStream.toByteArray(); XMLDecoder decoder = new XMLDecoder(new ByteArrayInputStream(buffer)); Rectangle outputRect = (Rectangle)decoder.readObject(); decoder.close(); if(!inputRect.equals(outputRect)) System.out.println("Not equal! Before: " + inputRect + " After: " + outputRect);