遍历eclipse代码模板中的字段 [英] Loop over fields in eclipse code template
本文介绍了遍历eclipse代码模板中的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您可以在代码模板中执行循环吗,例如我想打印类中的所有字段.有模板吗?
Can you do loops in code templates, e.g I want to print all the fields in a class. Is there a template for that?
推荐答案
Since I didn't find what I was looking for, I put it in my plugin. It supports variations.
If you have class
called Company
with fields companyName
, companyType
, etc. it will generate print statements as shown below if you select logger.debug variation :
if (logger.isDebugEnabled()) {
logger.debug("Company Name " + company.getCompanyName());
logger.debug("Company Type " + company.getCompanyType());
}
这篇关于遍历eclipse代码模板中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文