OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] XMLEncoder and PersistenceDelegates

[ 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?





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS