[
Lists Home |
Date Index |
Thread Index
]
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?
|