有没有一种方法来自动生成getter和setter在Eclipse?方法来、自动生成、getter、setter

2023-09-12 22:07:16 作者:不忘初心.

我工作的一个新的安卓项目(的Java ),并创建了大量的对象变量。因为我计划增加getter和setter所有的人,我想知道:有没有在 Eclipse的快捷方式自动生成的getter和setter在一个给定的类 解决方案

调出右键菜单(IE右键单击)所需类的源$ C ​​$ C窗口。然后选择来源子菜单;从菜单中选择生成getter和setter ... 将导致会出现一个向导窗口。

来源 - >生成getter和setter ...

选择您要创建getter和setter方法​​,然后单击变量确定

I am working on a new Android project (Java), and created an Object with a large number of variables. Since I am planning to add getters and setters for all of them, I was wondering: is there a shortcut in Eclipse for automatically generating the getters and setters in a given class?

解决方案 如何用Eclipse自动生成Getter,Setter,构造方法

Bring up the context menu (i.e. right click) in the source code window of the desired class. Then select the Source submenu; from that menu selecting Generate Getters and Setters... will cause a wizard window will appear.

Source -> Generate Getters and Setters...

Select the variables you wish to create getters and setters for and click OK.