有没有一种方法来自动生成getter和setter在Eclipse? [英] Is there a way to automatically generate getters and setters in Eclipse?

查看:344
本文介绍了有没有一种方法来自动生成getter和setter在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆