Develop alternative getter/setter generator

Good day everyone/anyone. What I would like to do seems simple, but I am not sure exactly how to get started.

Essentially, I would like to create a mechanism to generate a slightly different version of the default getter/setter generator for each variable in a class. So if I have:

public class Test{

     String foo;

}

I would like to generate:

public void setFoo(String foo){
     set("foo", foo);
}

instead of:

public void setFoo(String foo){
     this.foo = foo;
}

Any suggestions would be very welcome.

Thanks in advance,

Jay

Please sign in to leave a comment.