问题描述
我正在研究的项目规定了类成员变量的匈牙利表示法.示例:String m_foo;
The project I'm working on dictates hungarian notation for class member variables. Example: String m_foo;
在生成getter和setter时,是否可以使Eclipse去除匈牙利前缀?我正在使用Helios,它暗示了[c1>和setM_foo
(并不奇怪),但是我想要getFoo
和setFoo
.代码模板看起来没有帮助.
Is it possible to make Eclipse strip the hungarian prefix when generating getters and setters? I'm using Helios and it suggests (not surprisingly) getM_foo
and setM_foo
, but I want getFoo
and setFoo
. Code Templates doesn't look helpful.
推荐答案
在首选项页面Java> Code Style中,在命名约定表中,选择字段"行,按编辑"按钮,然后在其中键入"m_".前缀列表.
In the preference page Java>Code Style, in the naming conventions table, select the "Fields" row, press the Edit button, and type "m_" in the Prefix list.
这也有助于在生成字段时使用代码辅助.
This also helps with Code Assist when generating fields.
您还可以通过同一表为静态字段指定前缀.
You can also specify a prefix for static fields via the same table.
这篇关于Eclipse中用于匈牙利风格成员的Getter和Setters的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!