commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yang Diddy <iowoi10...@gmail.com>
Subject [beanutils]how can I use BeanUtils.populate to set value to my property with diff-argument type between setter and getter?
Date Thu, 27 Mar 2014 04:38:08 GMT
Please help:
if property of my class's setter and setter method arguments type doesn’t match, how can
i populate bean object?

public class Foo extends SomeClass{
private int id;

@Override
public Object getId() {
  return id;
}

public void setId(int id) {
   this.id = id;
}
}

// testing
Foo foot = new Foo();
Map<String,Object> values = new HashMap<String,Object>();
values.put(“id”,”1000”);
BeanUtils.populate(foo, values);
logger.debug(foo);
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message