[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XMLEncoder and PersistenceDelegates

  • To: xml-dev@l...
  • Subject: RE: XMLEncoder and PersistenceDelegates
  • From: Jeff Lowery <Jeff.Lowery@c...>
  • Date: Tue, 1 Jul 2003 13:45:06 -0700

xmlencoder
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.