Is there a way to make BeanUtils works with a protected setXXX(X x)
method? Or do you know some alternative to do this?
Something like:
public class A{
private String text;
public String getText(){
return this.text;
}
protected void setText(String text){
this.text = text;
}
}
public class B{
private String text;
public String getText(){
return this.text;
}
protected void setText(String text){
this.text = text;
}
}
public static void main(String[] args){
A a = new A();
a.setText("A text");
B b = new B();
BeanUtils.copyProperties(b, a);
System.out.println(b.getText()); //A text
}