[英]Autogenerate method response in Eclipse
Consider the following snippet of code 请考虑以下代码段
private MyOutputObject createMyOutputObject(MyInputObject myInputObject) {
}
To get rid of Eclipse's "must return a result of type..." compiler error alert, I will then add the following: 要摆脱Eclipse的“必须返回类型的结果......”编译器错误警报,我将添加以下内容:
private MyOutputObject createMyOutputObject(MyInputObject myInputObject) {
MyOutputObject myOutputObject = null;
return myOutputObject;
}
Is there any way within Eclipse to autogenerate this response creation? Eclipse中是否有任何方法可以自动生成此响应创建?
In Eclipse if you go to Preferences > Java > Code Style > Code Templates you will see a list of code templates. 在Eclipse中,如果转到“首选项”>“Java”>“代码样式”>“代码模板”,您将看到代码模板列表。 Under Code go to Method body and you can modify the generated code.
在Code下,转到Method body,您可以修改生成的代码。
您可以在eclipse中使用快速修复,它将return null
语句。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.