星期一, 九月 13, 2004

In java How to Get Embed Groovy Environment variable number?

在Java嵌入Groovy引擎后如何知道当前GroovyShell中环境中的变量.

Example:
Binding tempBind=_shell.getContext();
java.util.Map allenv=tempBind.getVariables();
java.util.Set keys=allenv.keySet();
java.util.Iterator keylist=keys.iterator();
while(keylist.hasNext())
{
Object index=keylist.next();
System.out.println(index+":"+allenv.get(index));
}