GetAndSetAdder modifies bytecode (.class) to add getter and setter method for every public attributes. It is usefull for allowing framework using reflection to access public attibute like old fashion property/javabean. It is the maven-getset-plugin, it works with maven, ant and from a shell/DOS.
It works on the bytecode, but to explain it's job, we use java version :
// MyBean.java in my editor
public class MyBean {
public String propertyA;
public String propertyB;
private int propertyC;
public String getPropertyB() {
return "unchanged";
}// MyBean.class after compilation and post-compilation by GetAndSetAdder
public class MyBean {
public String propertyA;
public String propertyB;
private int propertyC;
// the getter already exists, log warn during post-compilation,
// but the method stay unmodified
public String getPropertyB() {
return "unchanged";
}
// method added
public String getPropertyA() {
return propertyA;
}
public void setPropertyA(String v) {
propertyA = v;
}
public void setPropertyB(String v) {
propertyB = v;
}
// no method added about propertyC because it's a private field