Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想实现一个 Groovy 接口,它接受参数并在 java 中返回结果,并使其在 GroovyShell 中可用。但是 Callable、GroovyCallacble 不接受任何参数,因此它们对于我的目的是错误的。
任何提示将不胜感激。
可以在 java 中创建一个“Closure”子类并将其绑定到 GroovyShell 随附的 Bindings。一旦完成,就可以在绑定名称处从 groovy 执行闭包。