struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Map -> JavaBean API available @ dynclass.sourceforge.net
Date Wed, 28 Aug 2002 04:27:54 GMT


On Tue, 27 Aug 2002, John Raley wrote:

> Date: Tue, 27 Aug 2002 21:07:26 -0700
> From: John Raley <jb_raley@mindspring.com>
> Reply-To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Map -> JavaBean API available @ dynclass.sourceforge.net
>
> Hi Folks,
>
> I'm announcing an API that can convert a java Map to a JavaBean.  Before
> this, I was creating lots of silly inner classes like this (and I know
> I'm not the only JSP developer doing this):
>
> public class EmployeeBean {
>    public String getName() { ... }
>    public String getEmail() { ... }
>    String name;
>    String email;
>    // etc
> }
>
> I even wrote an emacs function to crank these out for me!
>
> Now you can do this:
>
> Class beanClass = BeanCreator.createClassForProperties(new String[] {
> "name", "email" });
> Object bean = BeanCreator.createBean(beanClass, theMap);
>
> where theMap contains your property-value mappings.
>
> I looked at DynaClass/DynaBean which I think solves this problem in a
> different way.  My concern with DynaClass is that standard JavaBeans
> tools will not recognize its properties (please correct me if I'm
> wrong).  BeanCreator takes a different approach, actually generating a
> Class at runtime to the JavaBeans specs.
>

You are correct -- DynaBeans are only recognized by classes that are
specifically DynaBean-aware (which includes, of course, any application
that uses commons-beanutils :-).

> The URL is http://dynclass.sourceforge.net/ and all feedback is welcome.
>
> John
>

Craig


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message