Is there a possibility to let Eclipse generate getter/setter in this form:
public int a;
public int b;
public get0(){return a;}
public get1(){return b;}
public set0(int val){a = val;}
etc. ?
Is there a possibility to let Eclipse generate getter/setter in this form:
public int a;
public int b;
public get0(){return a;}
public get1(){return b;}
public set0(int val){a = val;}
etc. ?
In Eclipse, there is an option to automatically generate Getters and Setters for all instance-fields you have in your class (or you can select the ones that you want, whatever). You'll want to go to the Source
tab, and scroll down to Generate Getters and Setters...
. From there, you should be able to choose which ones you want to generate.
As for actually calling them something other than the name of the variable, Eclipse doesn't really provide you with much. It may be better to do it manually, or even to make your own code generator, if you really want to.
You can go and fiddle with the Code Template
, as shown at the bottom of the Generate Getters and Setters
popup.
Right click where you want your getters -> source -> Generate Getters and Setters. Now only
select the the getters option. It will populate all your getters. Then repeat this for the setters below your getters. Then you will have the format you want.