You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/07/15 18:10:03 UTC

Is BeanUtils.copyProperties meant to replace "mapping" utilities

Subject: Is BeanUtils.copyProperties meant to replace "mapping" utilities
From: "Matt Raible" <ma...@raibledesigns.com>
 ===
I'm currently using:

http://www.mycgiserver.com/~andrej/technical/struts/struts.jsp

Will BeanUtils.copyProperties do this same thing?

Thanks,

Matt



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Is BeanUtils.copyProperties meant to replace "mapping" utilities

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 15 Jul 2002, Struts Newsgroup wrote:

> Date: Mon, 15 Jul 2002 09:10:03 -0700
> From: Struts Newsgroup <st...@basebeans.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Is BeanUtils.copyProperties meant to replace "mapping" utilities
>
> Subject: Is BeanUtils.copyProperties meant to replace "mapping" utilities
> From: "Matt Raible" <ma...@raibledesigns.com>
>  ===
> I'm currently using:
>
> http://www.mycgiserver.com/~andrej/technical/struts/struts.jsp
>
> Will BeanUtils.copyProperties do this same thing?
>

Pretty much, except:

* BeanUtils.copyProperties() does a shallow copy -- it does not
  recursively call itself on nested beans.

* BeanUtils.copyProperties() currently has a restriction that it doesn't
  deal with indexed and mapped properties that *only* have indexed and
  mapped getters/setters.  These are marked FIXME in the JavaDocs.  It
  works fine if you have getters/setters for the array/List or Map.

Things that BeanUtils.copyProperties() already does that might be of
interest include:

* Supports primitive properties.

* The origin or destination bean (or both) can be a standard JavaBean
  or a DynaBean.

* Conversions not restricted to String->Object, although that is the
  most common case for Struts users.

* Extensible conversions (register a Converter for your destination
  data type with ConvertUtils.register() and it will automatically
  get used).

> Thanks,
>
> Matt
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>