How can I use BeanUtils copyProperties to copy from boolean to Boolean?
Posted
by carrier
on Stack Overflow
See other posts from Stack Overflow
or by carrier
Published on 2009-03-05T13:23:53Z
Indexed on
2010/05/28
8:41 UTC
Read the original article
Hit count: 250
BeanUtils copyProperties, out of the box, doesn't seem to handle copying from Boolean object properties to boolean primitive properties.
I figured I could create and register a converter to handle this, but that just didn't seem to work.
So, how can I use BeanUtils to copy the properties from class Source to class Destination where:
public class Destination {
private boolean property;
public boolean isProperty() {
return property;
}
public void setProperty(boolean property) {
this.property = property;
}
}
public class Source{
private Boolean property;
public Boolean getProperty() {
return property;
}
public void setProperty(Boolean property) {
this.property = property;
}
}
© Stack Overflow or respective owner