commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miroslav Nachev <m...@space-comm.com>
Subject How to set some property using BeanUtils when the propery value (enum) is passed as String
Date Tue, 28 Apr 2009 13:48:58 GMT
Hi,

When I try to set one Enum property using BeanUtilsBean I have the 
following exception:
java.lang.IllegalArgumentException: Cannot invoke 
org.jdesktop.swingx.JXIntegerField.setNumberType on bean class 'class 
com.cosmos.swingb.JBIntegerField' - argument type mismatch - had objects 
of type "java.lang.String" but expected signature 
"org.jdesktop.swingx.JXIntegerField$NumberType"
        at 
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2181)
        at 
org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2141)
        at 
org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1948)
        at 
org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2054)
        at 
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1015)
        at 
com.cosmos.acacia.gui.entity.AbstractEntityPanel.main(AbstractEntityPanel.java:614)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2155)
        ... 5 more

This is not happen when property type is integer:
            BeanUtilsBean beanUtils = BeanUtilsBean.getInstance();
            beanUtils.setProperty(integerField, "columns", "7");
            beanUtils.setProperty(integerField, "numberType", "LongType");

Any suggestions how can solve the problem?


Regards,
Miro.

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


Mime
View raw message