easy-rules

easy-rules 4.0 发布了,基于java8 开发,有好多api 上的变动,以下是一个简单的说明

新特性

  • 添加一个新的领域对象Fact 替换以前的Map<String,Object>
  • Facts 添加了clear 方法
  • 添加了BeanResovler 到SpELAction 以及SpELCondition
  • MVAEL&& Spel 条件如果出现问题,将直接跑出异常(方便调试)
  • Spel 条件以及action使用#{...} 这个早期版本很不规范问题比较多

移动的api

  • RulesEngineParameters has been moved from package org.jeasy.rules.core to org.jeasy.rules.api
  • CompositeRule and its implementations (ActivationRuleGroup, UnitRuleGroup and ConditionalRuleGroup) have been moved from the root package org.jeasy.rules.support to a dedicated package org.jeasy.rules.support.composite
  • RuleDefinitionReader and its implementations (AbstractRuleDefinitionReader, YamlRuleDefintionReader and JsonRuleDefintionReader) have been moved from the root package org.jeasy.rules.support to a dedicated packageorg.jeasy.rules.support.readerzabbix-server-mysql |

删除的api

对于MVEL以及SpEL模块,ParserContext 传到rules 以及rule factories 在构造函数阶段

  • Methods org.jeasy.rules.mvel.MVELRule.when(String, ParserContext) and org.jeasy.rules.mvel.MVELRule.then(String, ParserContext)
  • Methods org.jeasy.rules.mvel.MVELRuleFactory.createRule(Reader, ParserContext) and org.jeasy.rules.mvel.MVELRuleFactory.createRules(Reader, ParserContext)
  • Methods org.jeasy.rules.spel.SpELRule.when(String, ParserContext) and org.jeasy.rules.spel.SpELRule.then(String, ParserContext)
  • Methods org.jeasy.rules.spel.SpELRuleFactory.createRule(Reader, ParserContext) and org.jeasy.rules.spel.SpELRuleFactory.createRules(Reader, ParserContext)
  • Methods org.jeasy.rules.support.AbstractRuleFactory.createSimpleRule(RuleDefinition, ParserContext) and org.jeasy.rules.support.AbstractRuleFactory.createCompositeRule(RuleDefinition, ParserContext) do not take a ParserContext as parameter anymore.

修改的api

因为提供了Fact 领域类型,所有有以下变动

  • Facts#put(String, Object) does not return the previous associated value if any, the return type is now void
  • Facts#remove(String) does not return the removed fact anymore, the return type is now void
  • Facts#iterator now returns a Iterato

说明

后边顺便把以前包装的一个spring boot starter 也升级调整了,4.0 的好多特性还是很不错的

参考资料

https://github.com/j-easy/easy-rules/releases

猜你喜欢

转载自www.cnblogs.com/rongfengliang/p/12985800.html