Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / October 2004

Tip: Looking for answers? Try searching our database.

Encoder and PersistenceDelegate question

Thread view: 
Allen Wallis - 19 Oct 2004 07:58 GMT
Hi,
I'm trying to find the best way of setting a custom
PersistenceDelegate for use by the XMLEncoder. Most documents I've
found say something like (for example):
XMLEncoder e = new XMLEncoder( System.out );
e.setPersistenceDelegate( MyType.class, new
DefaultPersistenceDelegate... )

This will not work if I haven't foreseen that some arb bean somewhere
happens to have a MyType field and I haven't set the correct
PersistenceDelegate.

Having perused the source, I see that there is a BeanDescriptor
attribute used called "persistenceDelegate" which can be set to the
persistence delegate of my choice. I've tested this and it works, and
hence seems like the best way of setting the correct
PersistenceDelegate for a given class. My concern is that I didn't
read this in any public API or tutorial, and so how can I be sure that
this method is correct, and will remain valid in years to come?

Thanks
Allen Wallis
Chris Riesbeck - 19 Oct 2004 19:03 GMT
> Hi,
> I'm trying to find the best way of setting a custom
[quoted text clipped - 7 lines]
> read this in any public API or tutorial, and so how can I be sure that
> this method is correct, and will remain valid in years to come?

It's in the API, if I understand you correctly, third
bullet:

http://java.sun.com/j2se/1.4.2/docs/api/java/beans/Encoder.html#getPersistenceDe
legate(java.lang.Class
)
Allen Wallis - 20 Oct 2004 06:34 GMT
> > Hi,
> > I'm trying to find the best way of setting a custom
[quoted text clipped - 12 lines]
>
> http://java.sun.com/j2se/1.4.2/docs/api/java/beans/Encoder.html#getPersistenceDe
legate(java.lang.Class
)

Oh dear, that's embarrassing, but thanks for pointing that out. I was
reading setPersistenceDelegate.
Thanks again

Allen


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.