For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > October 2004 > [common] convertUtils









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [common] convertUtils
alberto

2004-10-01, 8:58 am

I would like to copy a bean in an another bean with the same properties name
but some different type, using BeanUtils.copyProperties. ( in the common
package "org.apache.commons.beanutils")


I thought that conversions was possible but i am not able to make them
work!

For example ...where is the mistake?

class BeanString {
String age;
....public void set...
....public String get..
}
class BeanInteger {
Integer age;
....public void set
....public Integer get..
}

then i do

BeanInteger intBean = new...
BeanString stringBean = new...
PropertyUtils.copyProperties(intBean, stringBean);

and i get a NoSuchMethodException.



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com