Thought about that one as well, was just *too* lazy to write one more class :)
Thanks Craig, I will do that, Scott > -----Original Message----- > From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 10, 2002 4:22 PM > To: Jakarta Commons Developers List > Subject: Re: [DIGESTER] simple xml attribute to java > attribute mapping? > > > On Thu, 10 Jan 2002, Scott Sanders wrote: > > > Date: Thu, 10 Jan 2002 16:00:52 -0800 > > From: Scott Sanders <[EMAIL PROTECTED]> > > Reply-To: Jakarta Commons Developers List > > <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: [DIGESTER] simple xml attribute to java attribute mapping? > > > > What is the best way in digester to do a simple xml attr -> > java attr > > mapping. > > > > For example: > > > > <tag name="foo" style="bar"/> > > > > And the class looks like: > > > > Class Tag { > > public void setName(String name) {...} > > public void setStyleName(String style) {...} > > } > > > > The SetPropertiesRule handles the name->setName() case, but what is > > the easiest way to handle the style->setStyleName() case? > > > > Silly question, but my brain is dead, I am currently using > > CallMethodRule with CallParamRule, and I think there should be a > > better way :) > > > > There aren't any current Digester rules that do that kind of > thing for you. Presumably, you'd want to be able to map more > than one attribute-property pair. > > A way to make this work would be to define a BeanInfo class > for your bean class that returned a PropertyDescriptor for > the 'style' property that says the setter method is really > 'setStyleName'. This will get picked up by the introspection > mechanism in PropertyUtils (which is what Digester is using > underneath), with no changes to Digester. > > > Scott > > > > Craig > > > -- > To unsubscribe, e-mail: > <mailto:commons-dev-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
