On Thu, 18 Sep 2003 [EMAIL PROTECTED] wrote:
> Date: Thu, 18 Sep 2003 15:51:23 +0200
> From: [EMAIL PROTECTED]
> Reply-To: Jakarta Commons Users List <[EMAIL PROTECTED]>
> To: Jakarta Commons Users List <[EMAIL PROTECTED]>
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]