我正在编写一段 Groovy 代码,它将在特定应用程序(特别是 NoMagic / Cameo 企业架构)的上下文中执行。
根据他们的文档,他们提供了某些预定义对象,可以从我的 Groovy 脚本中引用这些对象作为全局变量。
我的问题是我的 IDE(IntelliJ IDEA)不知道这些对象,因此无法提供任何代码完成建议,并且在引用这些全局变量时也无法正确解析方法。
我想知道是否有办法记录这些变量的存在,以便 IntelliJ 能够识别它们。也许可以用 Groovydoc 来声明?
// I would like to declare that the global variable 'ALH' will be
// defined at runtime as a specific type.
// Perhaps something like the following?
/**
* @RuntimeValue
* com.nomagic.magicdraw.simulation.utils.ALH ALH
*/
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement
static void do_stuff(NamedElement e) {
// Do things...
}
NamedElement my_element = ALH.getCaller() // IntelliJ cannot resolve 'ALH'
do_stuff(my_element)