[jdom-interest] BeanMapper
Brett McLaughlin
brett.mclaughlin at lutris.com
Wed Sep 20 13:58:49 PDT 2000
Alex Chaffee wrote:
>
> Because there weren't enough XML Data Binding technologies already, I
> just wrote one using JDOM.
Not reading DeveloperWorks at IBM, are you ;-) There's a complete
framework, covered in 4 articles, there. It's based on JDOM and written
by yours truly ;-) Check it out:
http://www-4.ibm.com/software/developer/library/data-binding1/?dwzone=xml
http://www-4.ibm.com/software/developer/library/data-binding2/?dwzone=xml
http://www-4.ibm.com/software/developer/library/data-binding3/?dwzone=xml
This moves from XML to Java and back.
;-)
-Brett
>
> org.jdom.contrib.beans.BeanMapper allows you to easily (I'd say
> 'trivially' but that would be taunting the gods) make a JDOM tree from
> an existing JavaBean, and/or instantiate-and-fill one of your JavaBean
> classes based on a JDOM tree. By default it maps element names and
> property names directly, but you can override that by setting
> mappings; e.g. getFoo() could map to <foo>foovalue</foo> (the default)
> or <bar>foovalue</bar> or <baz baf="foovalue">.
>
> Usage:
>
> BeanMapper mapper = new BeanMapper();
>
> // Converting Bean to JDOM
> Document doc = mapper.toDocument(mybean);
>
> // Converting JDOM to Bean
> TestBean mybean = mapper.toBean(doc);
>
> It uses reflection, so it's not super-fast, but it's meant as a quick
> way to get started if you've got a a lot of beans already written and
> want to do XML import/export.
>
> I seem to have misplaced my CVS password. Jools, can you please
> contact me about checking this in? In the meantime, anyone who wants
> to play, please email me privately.
>
> - A
>
> --
> Alex Chaffee mailto:alex at jguru.com
> jGuru - Java News and FAQs http://www.jguru.com/alex/
> Creator of Gamelan http://www.gamelan.com/
> Founder of Purple Technology http://www.purpletech.com/
> Curator of Stinky Art Collective http://www.stinky.com/
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
--
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc.
1200 Pacific Avenue, Suite 300
Santa Cruz, CA 95060 USA
http://www.lutris.com
http://www.enhydra.org
More information about the jdom-interest
mailing list