commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [BeanUtils] IllegalArgumentException on a Collection
Date Thu, 18 Sep 2003 16:19:57 GMT
On Thu, 18 Sep 2003 Nicolas.CHALUMEAU@arsoe-trelaze.com wrote:

> Date: Thu, 18 Sep 2003 15:51:23 +0200
> From: Nicolas.CHALUMEAU@arsoe-trelaze.com
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> Subject: [BeanUtils] IllegalArgumentException on a Collection
>
> Hi
>
> I am new to BeanUtils so maybe it is a bad comprehension. I check the mail
> archive but found nothing about it.
>
> I try to use BeanUtils to initialize an object. The object definition is
> the next :
>
> public class Service extends ElementBouquet implements Serializable
> {
>     private String urlTraitement;
>     private String urlConfiguration;
>     private Iterator iterator;
>     private Collection mesPages;
>
>     /* constructor, getter and setter */
> }
>
> So I call :
> BeanUtils.setProperty( orig, (String) attrName, voDesc.get( attrName ) );
>

When you use setProperty() like this, BeanUtils requires that the data
type of the value must either

* Match exactly the data type of this property (Collection)

* Have a registered Converter that knows how to change
  the provided data type into the one needed by the
  property.

It sounds like this is not happening in your case, but there are not
enough details provided to know exactly where the difficulty lies.

Craig McClanahan


> Where attrName is the key of the attribut  in the Map instanciate with :
> Map voDesc = BeanUtils.describe(valueObject);
>
> It works fine with my urlTraitement, urlConfiguration, iterator properties
> but for mesPages I have the following error :
>
> java.lang.IllegalArgumentException: Cannot invoke
> com.arsoe.trelaze.socle.bouquetservice.Service.setMesPages - argument type
> mismatch
>         at
> org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1766)
>         at
> org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1747)
>         at
> org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1642)
>         at
> org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1671)
>         at
> org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1063)
>         at
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:358)
>         at
> com.arsoe.trelaze.socle.metier.BusinessObject.fusionner(BusinessObject.java:70)
>
> Is it a normal behavior or I really do an error ?
> Is it really the good methods to copy an attribut from a class to an other
> or I must do something else ?
>
> Thanks for help
> Nicolas
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

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


Mime
View raw message