我想创建一个像这样的 groovy 类 og 脚本:
//...
def slurper = new ConfigSlurper().parse(someFile)
//...
//The exact method declaration
def methodCall(def arg){
//Whatever i want to do
}
//Maybe it is easier with methodMissing
def methodMissing(def args) {
//Whatever i want to do
}
要 slurp 的文件可能如下所示:
some {
property = methodCall("with arg")
}
问题是我如何将“methodCall”委托给使用 configslurper 解析的类或脚本?目前它会给你一个methodMissing。