commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin van den Bemt <mll...@mvdb.net>
Subject Re: [Betwixt] Write static attributes to XML
Date Thu, 29 Jan 2004 00:35:20 GMT
It's a tough nut to crack. 
Betwixt started to use BeanInfo.getPropertyDescriptors(), which skips
statics, private and protected methods all together, when doing property
lookups. I believe this was handled by Betwixt itself in the past under
most conditions (except some swing classes, unless you specify
XMLIntrospector.setUseBeanInfoSearchPath(false))
We probably should reinstate the old behaviour, se we don't run into
these kind of limits. If the old code isn't sufficient enough, I can try
if I can make a library out of my introspection code that I have written
in Xulux..

I don't think we should limit the use of betwixt to just "beans" that
sun defined, but all objects where possible..

As for Samuel :
To get it working in the current state, say you have
org.apache.commons.betwixt.StaticPerson, create a 
org.apache.commons.betwixt.StaticPersonBeanInfo and it should work :)

Mvgr,
Martin

On Thu, 2004-01-29 at 00:11, robert burrell donkin wrote:
> am i correct in thinking that you want to read and write static fields?
> 
> betwixt current lacks the ability to read and write fields. since 
> betwixt uses reflection, i think that adding support for reading and 
> writing field to betwixt should solve your problem.
> 
> if you want to tackle this, the first place to start is by constructing 
> a FieldUpdater and a FieldExpression to manage writing and reading to 
> the current bean (obtained from the Context) plus unit tests to prove 
> that they work correctly.
> 
> next, you'll need to add mechanisms to allow introspection to update 
> and express fields. the easiest way to make this work would be to add 
> support into dot betwixt files. add extra attributes into the element 
> tag to specify the field (rather than the property). change ElementRule 
> so that it creates FieldUpdaters and FieldExpressions. again, create 
> unit tests.
> 
> it would be more involved to add automatic discovery at introspection 
> time. i'd suggest a chain of post processing rules to add extra 
> elements and then create a strategy that discovers fields. the default 
> should be the current behaviour (no field discovery).
> 
> should be easy but there's quite a bit of leg work.
> 
> if you fancy donating your work back to the ASF please post attachment 
> to bugzilla or submit a PATCH. please remember to include the ASF 
> license (signifying that you grant the ASF copyright over the work). 
> for more information please read:
> 
> http://jakarta.apache.org/commons/patches.html
> http://jakarta.apache.org/site/getinvolved.html
> 
> also please remember to use current CVS (either HEAD or the branch 
> would be fine).
> 
> hope this is enough to get you started :)
> 
> - robert
> 
> On 28 Jan 2004, at 22:39, Samuel Cheung wrote:
> 
> > Thanks. Do you mind where is the best place to add that?
> >
> > Thank you.
> >
> >
> > -----Original Message-----
> > From: robert burrell donkin
> > [mailto:robertburrelldonkin@blueyonder.co.uk]
> > Sent: Wednesday, January 28, 2004 4:29 PM
> > To: Jakarta Commons Developers List
> > Subject: Re: [Betwixt] Write static attributes to XML
> >
> >
> > On 28 Jan 2004, at 19:16, Samuel Cheung wrote:
> >
> >> Hi,
> >>
> >> Does Betwixt support writing static attributes of a class to XML?
> >
> > probably not at the moment. this is probably a very easy feature to
> > add, though.
> >
> > - robert
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
-- 
Mvgr,
Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message