[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XMLEncoder and PersistenceDelegates
Anybody here using java.beans.XMLEncoder? I've got a class with a data member that gets initialized to a default instance. I want to overwrite the default instance with a persisted instance. I thought the following persistence delegate would do the job: encoder.setPersistenceDelegate(ContainerOfX.class, new DefaultPersistenceDelegate() { protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); out.writeStatement(new Statement(oldInstance, "setX", new Object[] { ((ContainerOfX) oldInstance).getX() })); } }); Which I would expect to produce and XML-encoded setX statement in the output file with the correct value from the original instance, but no such statement is printed. I've checked that out.executeStatements == true right before the writeStatement() call, so what gives?
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|