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