在Groovy / IntelliJ中,“添加动态方法”是做什么的? [英] What does 'add dynamic method' do in Groovy/IntelliJ?

查看:172
本文介绍了在Groovy / IntelliJ中,“添加动态方法”是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Groovy / IntelliJ中使用未定义的方法时,按下alt-Enter,我得到以下选项:添加动态方法。当我这样做时,我得到一个具有新动态属性的动态属性窗口。

我不明白如何使用这个动态属性/方法。我在哪里定义它?这是什么意思?

文档中的这个页面解释它。



基本上,您可以使用此方法来告诉IDE关于你设置的动态属性或方法,然后Syntax Highlighter和Code Completion可以处理它。



没有这个,我相信你会得到有效的代码标记为错误,以及代码完成窗口中缺少的内容。


When I use an undefined method in Groovy/IntelliJ, and I press alt-Enter, I get the following option: "Add dynamic method". When I do it, I get a "dynamic properties" windows with a new dynamic property.

I don't understand how to use this dynamic property/method. Where do I define it? What does it mean?

解决方案

This page in the documentation explains it.

Basically, you can use this method to tell the IDE about dynamic properties or methods you have set up, and then the Syntax Highlighter and Code Completion can handle it.

Without this, I believe you would end up with valid code marked as erroneous, and things missing from the code completion window.

这篇关于在Groovy / IntelliJ中,“添加动态方法”是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆