We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
最近遇到个使用场景:
有几百个产品对象,每个产品有自己的常量、方法、计算公式,且产品之间的常量、方法是不共享的。
思考了一下,思路如下:
最终按照思路3去处理的,且修改了下源码,虽然暂时实现了功能,但是后期升级成本变高了,还不知是否存在隐患。 源码修改点:
1. AviatorEvaluatorInstance去掉final,使其能被继承; 2. AviatorEvaluatorInstance构造方法添加public;
新编写的"AviatorEvaluatorInstance"继承自原有的AviatorEvaluatorInstance,且做如下修改:
1. 添加自己的Map<String, Object> ownFuncMap,用于存放自己的方法; 2. 修改getFunction相关方法,使其可以查找ownFuncMap; 3. 新AviatorEvaluatorInstance的构造器改成如下,以实现基础库的共享: public AviatorEvaluatorInstanceX(final AviatorEvaluatorInstance instance) { this.aviatorClassLoader = instance.getAviatorClassLoader(); this.traceOutputStream = instance.getTraceOutputStream(); this.functionMissing = instance.getFunctionMissing(); this.cachedExpressionByDefault = instance.isCachedExpressionByDefault(); this.options = instance.getOriginalOptions(); this.funcMap = instance.getFuncMap(); this.moduleCache = instance.getModuleCache(); this.functionLoaders = instance.getFunctionLoaders(); this.envProcessor = instance.getEnvProcessor(); }
所以,请问下,以后会考虑支持上边的使用场景吗? 就是可以让AviatorEvaluatorInstance构造时传入一个parent,且AviatorEvaluatorInstance中的基础库和parent共享,而不是再去load自己的。
The text was updated successfully, but these errors were encountered:
parent 共享的方式是个好主意,我想想 API 设计
Sorry, something went wrong.
期待。
No branches or pull requests
最近遇到个使用场景:
思考了一下,思路如下:
最终按照思路3去处理的,且修改了下源码,虽然暂时实现了功能,但是后期升级成本变高了,还不知是否存在隐患。
源码修改点:
新编写的"AviatorEvaluatorInstance"继承自原有的AviatorEvaluatorInstance,且做如下修改:
所以,请问下,以后会考虑支持上边的使用场景吗?
就是可以让AviatorEvaluatorInstance构造时传入一个parent,且AviatorEvaluatorInstance中的基础库和parent共享,而不是再去load自己的。
The text was updated successfully, but these errors were encountered: