如何将Xtend代码转换为Xtend模板

发布于 2025-01-22 13:17:11 字数 500 浏览 4 评论 0原文

我有一个用Xtend编写的代码,在那里我不使用模板,但我只是在打印出来。但是,我了解到Xtend最有力的事情是它是基于模板的。因此,现在我想在Xtend中写下它。有什么简单的方法(并不是真的认为有一个,但是代码很长,所以我想尝试一下)。 其次,如果我有以下内容:

def method(){
method1()
method2()
method3()
...
}

在Xtend中,我应该写作

def method(){
'''
 «method1()»
 «method2()»
 «method3()»
...
'''
}

,或者也可以写作,


def method(){
'''
 «method1()
 method2()
 method3()»
...
'''
}

以便在不必实际打印任何东西时只使用一次终端。 欢迎将促进根据Xtend模板转换代码的任何其他提示。

谢谢!

I have a code written in Xtend, where I am not using templates but I am just printing things out. However, I learned that one the most powerful things about Xtend is that it is template based. Therefore, now I want to write it in Xtend. Is there any simple way to do it (don't really think there is one but the code is quite long so thought I would give it a try asking).
Second, if I have the following:

def method(){
method1()
method2()
method3()
...
}

In Xtend should I write

def method(){
'''
 «method1()»
 «method2()»
 «method3()»
...
'''
}

Or can I also write


def method(){
'''
 «method1()
 method2()
 method3()»
...
'''
}

So to use the terminal only once if I don't have to actually print anything.
Any other tips that would facilitate converting the code according to the Xtend templates are welcomed.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文