二、栗子
2.、使用举例
//源码字符串String codeStr = "package org.hocate.test; " + "import org.voovan.tools.TString; " + "public class testSay { " + " public String say(){ " + " System.out.println(\"helloword\"); " + " return TString.removePrefix(\"finished\"); " + " } " + "} "; //在日志平台输出源码 Logger.simple(codeStr); //构造编译对象 Complier dc = new Complier(); //编译代码 dc.compileCode(codeStr);}public void testRun() throws Exception{ //使用反射工具类实例化对象 Object testSay = TReflect.newInstance("org.hocate.test.testSay"); //使用反射工具执行方法 Object obj = TReflect.invokeMethod(testSay, "say"); //在日志平台输出源码 Logger.simple(obj);}