有没有一种方法来自动生成getter和setter在Eclipse? [英] Is there a way to automatically generate getters and setters in Eclipse?
问题描述
我工作的一个新的安卓
项目(的Java
),并创建了大量的对象变量。因为我计划增加getter和setter所有的人,我想知道:有没有在 Eclipse的快捷方式
自动生成的getter和setter在一个给定的类<? / P>
调出右键菜单(IE右键单击)所需类的源$ C $ C窗口。然后选择来源
子菜单;从菜单中选择生成getter和setter ...
将导致会出现一个向导窗口。
来源 - &GT;生成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?
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
.
这篇关于有没有一种方法来自动生成getter和setter在Eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!