Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates MyEclipse的Getter/Setter方法_Templates_Myeclipse - Fatal编程技术网

Templates MyEclipse的Getter/Setter方法

Templates MyEclipse的Getter/Setter方法,templates,myeclipse,Templates,Myeclipse,我需要知道在MyEclipse中用于生成getter/setter方法的模板代码中使用的是哪种语言 1) 我想在myeclipse的getter/setter方法模板代码中使用静态实用程序方法。 2) 我只想在字段数据类型为字符串时调用我的实用工具方法。所有模板中都使用Velocity。窗口>首选项>Java>编辑器>模板将允许您为代码添加新模板。你可以在那里创建模板,如果你把它命名为StringGetterSetter,你所要做的就是键入“str-ctrl-space-enter”,然后插入方

我需要知道在MyEclipse中用于生成getter/setter方法的模板代码中使用的是哪种语言

1) 我想在myeclipse的getter/setter方法模板代码中使用静态实用程序方法。
2) 我只想在字段数据类型为字符串时调用我的实用工具方法。

所有模板中都使用Velocity。

窗口>首选项>Java>编辑器>模板将允许您为代码添加新模板。你可以在那里创建模板,如果你把它命名为StringGetterSetter,你所要做的就是键入“str-ctrl-space-enter”,然后插入方法

您可以使用窗口>首选项>Java>代码样式>代码模板>代码>getter正文中的setter/getter模板作为复制的基础

我认为您更愿意调整这些,以便它们在类型为字符串时自动检测,并调整插入的代码。我认为这里没有变量可以告诉您设置/获取的字段的类型。elemType函数可在编辑器>模板部分中使用,该部分允许更复杂的检查

(我使用MyEclipse 8.0)