我是groovy.I新手,正在从控制台读取两行代码的值。如何从控制台读取参数到groovy中的方法?
System.in.withReader {
println "Version: "
version = it.readLine()
println "Doc Type:"
Doc=it.readLine()
call getBillID(version,Doc)
}
getBillid
方法如下,
def getBillID(int version,int doc)
{
allNodes.BillID.each {
theregularExpression=/\d+_\d+_\d+_\d_\d+_\d+_\d_${version}_${Doc}_\d+_\d+/
if(it != "" && it =~ theregularExpression) {
println "******" + it
}
}
}
现在我想在我的getBILLID
方法使用这些变量的值,但我得到的错误作为
No signature of method: ReadXML.getBillID() is applicable for argument types: (java.lang.String, java.lang.String) values: [9, ]
我哪里错了。可以任何一个告诉我plz ..
什么类型allnodes中?看起来系统期望从XML文件读取,allNodes看起来像是面向XML的,这使得很难看到你想从控制台获取值。 – OldTroll 2011-05-27 18:53:41