起因
这次的起因是上篇文章中退而求其次的做法离目标太远,没有达到目标中实时更换的效果,为了更加达到目标效果,对源码进行一次 跟踪,这次是跟踪记录,记录不一定全面,见谅,如有帮助,万分荣幸,
跟踪记录
- 这里使用运行模式对function进行缓存,所以入口为下面的代码
MapVariableResolverFactory resolverFactory = new MapVariableResolverFactory();
ParserContext ctx = new ParserContext();
MVEL.eval(charArr, ctx, resolverFactory);
charArr是函数的字符串
2. 进入后可以看到如下图所示的代码,这里先对MVELInterpretedRuntime进行了参数初始化,执行parse();
3. 进入parse()方法中可以看到这里还是在对MVELInterpretedRuntime进行参数的初始化,之后执行parseAndExecuteInterpreted();
4. 进入parseAndExecuteInterpreted()&#x