The simple, stupid rules engine for Java
This version is a minor release which comes with the following new features, enhancements and bug fixes:
size
method in Rules
APIRules#register
/ Rules#unregister
methods to accept varargsRuleProxy
to accept types implementing Comparable
I would like to thank all contributors who helped making this release possible!
This is a major release which is based on Java 8. This version comes with a number of new features and bug fixes (See detailed list below). Moreover, some breaking changes have been introduced to fix a couple of design inconsistencies in v3. Here are the major changes:
Fact
domain concept which replaces the Map<String, Object>
data structure used in v3. This new concept has a number of advantages like type safety, better encapsulation and a cleaner API.false
. This makes it possible to correctly unit test conditions as well as listen to evaluation errors with a rule listener (a new method RuleListener#onEvaluationError
has been introduced for this purpose).#{ ... }
template by default. This is configurable but it has been made the default to be consistent with Spring's default template parser.Moreover, thanks to this major Java version upgrade, a lot of improvements have been introduced in the API (like using default methods in interfaces, adding @FunctionalInterface
where appropriate, etc) as well as in the code base (using lambdas and streams where it made sense, using new reflection APIs introduced in Java 8, etc).
Here is the list of issues resolved in this release:
Fact
conceptclear
method in Facts
APIBeanResolver
to SpELAction
and SpELCondition
Facts#asMap
should return an immutable map or a copy of the factsMVELCondition
does not re-throw exceptionsSpELRule
and SpELRuleFactory
Facts#iterator
to mention that it should not be used to remove factsI would like to thank all contributors who made this release possible by reporting issues, testing fixes, requesting features and participating in discussions: @readilychen, @elitacco, @snok3r, @AleksandrPalchuk, @turiandras, @Alexey1Gavrilov, @yunfengwang and @R-Gerard ! Thank you all for your contributions!
A special BIG thank you to @zhhaojie for following up on issues, helping in design discussions and all the time and effort put on Easy Rules!
The following APIs have been moved between packages for better cohesion:
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.reader
Action: Update import statements where the aforementioned classes are used
For both MVEL and SpEL modules, the ParserContext
is now passed to rules and rule factories at construction time. Hence, all overloaded methods where the parser context is passed as a parameter (which are now useless) have been removed:
org.jeasy.rules.mvel.MVELRule.when(String, ParserContext)
and org.jeasy.rules.mvel.MVELRule.then(String, ParserContext)
org.jeasy.rules.mvel.MVELRuleFactory.createRule(Reader, ParserContext)
and org.jeasy.rules.mvel.MVELRuleFactory.createRules(Reader, ParserContext)
org.jeasy.rules.spel.SpELRule.when(String, ParserContext)
and org.jeasy.rules.spel.SpELRule.then(String, ParserContext)
org.jeasy.rules.spel.SpELRuleFactory.createRule(Reader, ParserContext)
and org.jeasy.rules.spel.SpELRuleFactory.createRules(Reader, ParserContext)
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.Action: Pass the parser context at construction time (to the rule or the rule factory) and call new methods that do not take the parser context as parameter.
Due to the introduction of the new Fact
concept (issue #276), the following method signatures have been changed:
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 Iterator<Fact>
instead of Iterator<Map.Entry<String, Object>>
Actions:
Facts#put
, since the previously associated value if any is not returned anymore, one can query the Facts
API to see if there is a fact mapped for the given name before calling put
.Facts#remove
, since the removed fact is not returned anymore, one can query the Facts
API
to get the fact before removing it.This is a minor release with a few enhancements and bug fixes:
AbstractRulesEngine
publicDefaultRuleListener
and DefaultRulesEngineListener
InferenceRulesEngine
Many thanks to all contributors for their help in this release!
❗️ Please note that this is the last release in the v3 line. Next version will be 4.0.0 and will be based on Java 8.
This release is a minor version with the following changes:
DEBUG
RulesEngine#getListeners
and RulesEngine#getRulesEngineListeners
should return a unmodifiable list of listenersRulesEngine#getParameters
should return a copy of the parametersMVELAction
does not re-throw exceptionsConditionalRuleGroup
has wrong priority control❗️ Heads-up: Even though this is a minor release, there is a small breaking change in the MVELRuleFactory
API. It was not possible to introduce SpEL and JSON support without introducing this breaking change, and waiting for a major release (Java 8 baseline) did not make sense. Semantic versioning rules are not as easy to implement as Easy Rules 😄
Many thanks to @Jeff-Jia, @wuhaidu, @khaledabderrahim, @ramnaresh2051, @kayeight, @amitvj1 and @mr0815mr for their contributions to this release!
This is the second maintenance release of the 3.x line. It introduces a new module called easy-rules-support
. This module contains support classes that were in the easy-rules-core
module. For instance, the org.jeasy.rules.core.CompositeRule
has been moved to easy-rules-support
as org.jeasy.rules.support.CompositeRule
and made abstract. 3 implementations of composite rules are now provided out of the box:
UnitRuleGroup
: All or nothing semantics (exactly the same as CompositeRule
in previous versions)ActivationRuleGroup
: XOR logic, ie only one rule of the group will be triggered (issue #122)ConditionalRuleGroup
: A primary rule acts as a precondition to trigger the rule group (issue #130)This release comes with other new features and some bug fixes:
@Rule
annotationtoString()
is not equal to original object toString()
MVELRuleDefinitionReader
if rule name, description or priority is not specifiedMVELRuleFactory#createRuleFrom(java.io.File)
. A new method that takes a java.io.Reader
is to be used instead to be able to read rules not only from files (with a FileReader
), but also from Strings (with a StringReader
) or any other reader implementation.org.jeasy.rules.core.CompositeRule
is deprecated. It has been moved to the new easy-rules-support
module and is now abstract.I would like to thank @dagframstad, @danrivcap, @bpoussin and @paulbrejla for their contributions to this release.
This release is another important milestone for Easy Rules! We finally managed to get some long awaited features out :smile:
The major additions of v3.1 are:
Condition
, Action
and RuleBuilder
APIsThis release has also introduced a lot of API improvements thanks to some amazing contributors! Here is the full list of changes:
Condition
/ Action
APIsRulesEngineParameters#setSilentMode
and RulesEngineParameters#isSilentMode
as well as constructors taking silentMode
parameterI would like to thank @wg1j, @sanmibuh, @shivmitra, @cemo and @khandelwalankit for their contributions!
This is a big milestone for Easy Rules since the beginning! v2.x was a successful line but we must admit it suffered from a couple of design decisions:
v3 is finally here to fix these issues! Please find below the most important changes and additions.
Easy Rules is now part of the jeasy project. Hence, the maven's groupId
has changed from org.easyrules
toorg.jeasy
Online documentation has been moved from www.easyrules.org
to the wiki of the github project. The www.easyrules.org
site will be shutdown on 31/07/2017.
Gitter chat room has been moved from https://gitter.im/easyrules/easyrules
to https://gitter.im/j-easy/easy-rules
Facts
APIRules
API@Fact
annotation to inject facts in conditions and actions methods of rulesThe DefaultRulesEngine
class is now public. Keys APIs (Rule
, RulesEngine
and RuleListener
) have been updated to accept Rules
and Facts
in their methods signatures. Please refer to the javadoc for all details about these changes.
This release would not have been possible without the help of some awseome contributors! We are grateful to all of them! Thank you for your time and effort.
This is the latest version in v2.x line. It adds the following features and bug fixes:
RuleListener
API@SpringRule
annotation is not inherited in child classesIn this version, support for Spring and Quartz has been deprecated and will be removed in v3.0.
Many thanks to @khandelwalankit, @cogito-clarus, @careerscale, @cgonul, @pklovesbacon and @yisraelU for reporting issues and testing fixes.
A special thank to @andersonkyle for adding a spring boot starter to easy rules! A big thank goes to @will-gilbert for implementing easy rules tutorials with groovy!
This is a minor release with the following changes:
skipOnFirstNonTriggeredRule
parameterBasicRule.getPriority
method is overriddenUtils
class should not be publicMany thanks to all contributors, especially @toudidel and @spearway and @JurMarky, for reporting issues, fixing bugs and implementing features.
beforeEvaluate
in RuleListener
getListeners
in RulesEngine
to get registered listenerscheckRules
in RulesEngine
to check rules without firing them