{"id":15044900,"url":"https://github.com/dvgaba/easy-rules","last_synced_at":"2025-04-10T00:43:12.289Z","repository":{"id":42055447,"uuid":"418184292","full_name":"dvgaba/easy-rules","owner":"dvgaba","description":"The simple, stupid rules engine for Java","archived":false,"fork":false,"pushed_at":"2024-06-03T23:37:09.000Z","size":2058,"stargazers_count":10,"open_issues_count":4,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-10T00:43:06.503Z","etag":null,"topics":["business-rules","expression-language","java","java-11","jjdk11","programming-rules","rule-engine","rules-engines"],"latest_commit_sha":null,"homepage":"https://github.com/j-easy/easy-rules/wiki","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvgaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-17T16:09:01.000Z","updated_at":"2024-10-18T15:44:35.000Z","dependencies_parsed_at":"2024-01-16T04:15:25.030Z","dependency_job_id":"5692eb7d-0a02-4610-8a89-78b83b2f61e9","html_url":"https://github.com/dvgaba/easy-rules","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvgaba%2Feasy-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvgaba%2Feasy-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvgaba%2Feasy-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvgaba%2Feasy-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvgaba","download_url":"https://codeload.github.com/dvgaba/easy-rules/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137998,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["business-rules","expression-language","java","java-11","jjdk11","programming-rules","rule-engine","rules-engines"],"created_at":"2024-09-24T20:51:12.445Z","updated_at":"2025-04-10T00:43:12.267Z","avatar_url":"https://github.com/dvgaba.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"***\n\n\u003cdiv align=\"center\"\u003e\n    \u003cb\u003e\u003cem\u003eEasy Rules\u003c/em\u003e\u003c/b\u003e\u003cbr\u003e\n    The simple, stupid rules engine for Java\u0026trade;\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](http://opensource.org/licenses/MIT)\n[![Build Status](https://github.com/dvgaba/easy-rules/workflows/Java%20CI/badge.svg)](https://github.com/dvgaba/easy-rules/actions)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.dvgaba/easy-rules-core/badge.svg?style=flat)](http://search.maven.org/#artifactdetails|io.github.dvgaba|easy-rules-core|1.0.7|)\n[![Javadoc](https://www.javadoc.io/badge/io.github.dvgaba/easy-rules-core.svg)](https://www.javadoc.io/doc/io.github.dvgaba/easy-rules-core)\n[![Project status](https://img.shields.io/badge/Project%20status-active-green.svg)](https://img.shields.io/badge/Project%20status-active-green.svg)\n\n\u003c/div\u003e\n\n***\n\n## Project status\n\nThis project is forked from [j-easy/easy-rules](https://github.com/j-easy/easy-rules) because it is\nin maintenance mode. Current plan is to support community with minor enhancements and bug fixes.\n\n## Latest news\n* 6/3/2024: Version 1.2.0. Bumped mvel version to 2.5.2.FINAL to fix issue with JDK 21.\n* 01/15/2024: Version 1.1.0 is out\n  * 3PP Version bumps\n  * easy-rules-jexl - Breaking change due to bump to Jexl 3.3\n\n* 02/13/2023: Version 1.0.7 is out\n  Minor release to fix jackson vulnerability\n\n* 08/06/2022: Version 1.0.5 is out\n  Minor release to support optional fact parameters.\n\n* 08/02/2022: Version 1.0.4 is out\n  Upgraded to JDK 11/Junit 5\n  Fixed dependency vulnerabilities\n  New parameter isFailsOnException for better exception handling\n  \n\n* 06/12/2020: Version 4.1 is out with a new module to\n  support [Apache JEXL](https://commons.apache.org/proper/commons-jexl/) as an additional supported\n  expression language! You can find all details about other changes in\n  the [release notes](https://github.com/dvgaba/easy-rules/releases).\n\n## What is Easy Rules?\n\nEasy Rules is a Java rules engine inspired by an article\ncalled *\"[Should I use a Rules Engine?](http://martinfowler.com/bliki/RulesEngine.html)\"*\nof [Martin Fowler](http://martinfowler.com/) in which Martin says:\n\n\u003e You can build a simple rules engine yourself. All you need is to create a bunch of objects with conditions and actions, store them in a collection, and run through them to evaluate the conditions and execute the actions.\n\nThis is exactly what Easy Rules does, it provides the `Rule` abstraction to create rules with\nconditions and actions, and the `RulesEngine` API that runs through a set of rules to evaluate\nconditions and execute actions.\n\n## Core features\n\n* Lightweight library and easy to learn API\n* POJO based development with an annotation programming model\n* Useful abstractions to define business rules and apply them easily with Java\n* The ability to create composite rules from primitive ones\n* The ability to define rules using an Expression Language (Like MVEL, SpEL and JEXL)\n\n## Example\n\n### 1. First, define your rule..\n\n#### Either in a declarative way using annotations:\n\n```java\n\n@Rule(name = \"weather rule\", description = \"if it rains then take an umbrella\")\npublic class WeatherRule {\n\n  @Condition\n  public boolean itRains(@Fact(\"rain\") boolean rain) {\n    return rain;\n  }\n\n  @Action\n  public void takeAnUmbrella() {\n    System.out.println(\"It rains, take an umbrella!\");\n  }\n}\n```\n\n#### Or in a programmatic way with a fluent API:\n\n```java\nRule weatherRule=new RuleBuilder()\n    .name(\"weather rule\")\n    .description(\"if it rains then take an umbrella\")\n    .when(facts-\u003efacts.get(\"rain\").equals(true))\n    .then(facts-\u003eSystem.out.println(\"It rains, take an umbrella!\"))\n    .build();\n```\n\n#### Or using an Expression Language:\n\n```java\nRule weatherRule=new MVELRule()\n    .name(\"weather rule\")\n    .description(\"if it rains then take an umbrella\")\n    .when(\"rain == true\")\n    .then(\"System.out.println(\\\"It rains, take an umbrella!\\\");\");\n```\n\n#### Or using a rule descriptor:\n\nLike in the following `weather-rule.yml` example file:\n\n```yaml\nname: \"weather rule\"\ndescription: \"if it rains then take an umbrella\"\ncondition: \"rain == true\"\nactions:\n  - \"System.out.println(\\\"It rains, take an umbrella!\\\");\"\n```\n\n```java\nMVELRuleFactory ruleFactory=new MVELRuleFactory(new YamlRuleDefinitionReader());\n    Rule weatherRule=ruleFactory.createRule(new FileReader(\"weather-rule.yml\"));\n```\n\n### 2. Then, fire it!\n\n```java\npublic class Test {\n\n  public static void main(String[] args) {\n    // define facts\n    Facts facts = new Facts();\n    facts.put(\"rain\", true);\n\n    // define rules\n    Rule weatherRule = ...\n    Rules rules = new Rules();\n    rules.register(weatherRule);\n\n    // fire rules on known facts\n    RulesEngine rulesEngine = new DefaultRulesEngine();\n    rulesEngine.fire(rules, facts);\n  }\n}\n```\n\nThis is the hello world of Easy Rules. You can find other examples like\nthe [Shop](https://github.com/j-easy/easy-rules/wiki/shop)\n, [Airco](https://github.com/j-easy/easy-rules/wiki/air-conditioning)\nor [WebApp](https://github.com/j-easy/easy-rules/wiki/web-app) tutorials in the wiki.\n\n## Contribution\n\nYou are welcome to contribute to the project with pull requests on GitHub. If you believe you found\na bug or have any question, please use\nthe [issue tracker](https://github.com/dvgaba/easy-rules/issues).\n\n## Awesome contributors\n\n* [Alexey1Gavrilov](https://github.com/Alexey1Gavrilov)\n* [andersonkyle](https://github.com/andersonkyle)\n* [aston2016](https://github.com/aston2016)\n* [avakimov](https://github.com/avakimov)\n* [beccagaspard](https://github.com/beccagaspard)\n* [bpoussin](https://github.com/bpoussin)\n* [cgonul](https://github.com/cgonul)\n* [cemo](https://github.com/cemo)\n* [dagframstad](https://github.com/dagframstad)\n* [danrivcap](https://github.com/danrivcap)\n* [Desislav-Petrov](https://github.com/Desislav-Petrov)\n* [drem-darios](https://github.com/drem-darios)\n* [gs-spadmanabhan](https://github.com/gs-spadmanabhan)\n* [JurMarky](https://github.com/JurMarky)\n* [jordanjennings](https://github.com/jordanjennings)\n* [kayeight](https://github.com/kayeight)\n* [khandelwalankit](https://github.com/khandelwalankit)\n* [lranasingha](https://github.com/lranasingha)\n* [laurikimmel](https://github.com/laurikimmel)\n* [mrcritical](https://github.com/mrcritical)\n* [paulbrejla](https://github.com/paulbrejla)\n* [richdouglasevans](https://github.com/richdouglasevans)\n* [ruanjiehui](https://github.com/ruanjiehui)\n* [spearway](https://github.com/spearway)\n* [stefanbirkner](https://github.com/stefanbirkner)\n* [toudidel](https://github.com/toudidel)\n* [vinoct6](https://github.com/vinoct6)\n* [wg1j](https://github.com/wg1j)\n* [will-gilbert](https://github.com/will-gilbert)\n* [WayneCui](https://github.com/WayneCui)\n* [sanmibuh](https://github.com/sanmibuh)\n* [shivmitra](https://github.com/shivmitra)\n* [zhhaojie](https://github.com/zhhaojie)\n\nThank you all for your contributions!\n\n## Easy Rules in other languages\n\n* [EasyRulesGo](https://github.com/CrowdStrike/easyrulesgo) : A port of EasyRules to Golang\n  by [@jiminoc](https://github.com/jiminoc)\n* [EasyRulesGroovy](https://github.com/will-gilbert/easyrules-tutorials-groovy) : A port of\n  EasyRules tutorials to Groovy by [@will-gilbert](https://github.com/will-gilbert)\n* [EasyRulesCsharp](https://github.com/feldrim/EasyRulesCsharp) : A port of EasyRules to CSharp (\n  WIP) by [@feldrim](https://github.com/feldrim)\n* [Easy-Rules-.NET](https://github.com/skuehlshelby/Easy-Rules-.NET) : A port of EasyRules to .NET\n  Core by [@skuehlshelby](https://github.com/skuehlshelby)\n\n## Who is using Easy Rules?\n\n* [Apache Nifi](https://nifi.apache.org) (\n  see [Nifi EasyRules Bundle](https://github.com/apache/nifi/tree/rel/nifi-1.12.1/nifi-nar-bundles/nifi-easyrules-bundle))\n* [Open Remote](https://openremote.io) (\n  see [build.gradle](https://github.com/openremote/openremote/blob/v1.0.4/model/build.gradle#L27))\n* [Open Smart Register Platform](http://smartregister.org) (\n  see [build.gradle](https://github.com/OpenSRP/opensrp-client-anc/blob/v1.5.0/opensrp-anc/build.gradle#L196))\n* [Toad Edge by Quest](https://support.quest.com/fr-fr/technical-documents/toad-edge/2.1/user-guide/14)\n* [Extreme Networks](https://cloud.kapostcontent.net/pub/c4c24aae-b82d-44e4-8d86-01c235e4b40f/open-source-declaration-for-extr-xmc-8-dot-5)\n\n## Credits\n\n![YourKit Java Profiler](https://www.yourkit.com/images/yklogo.png)\n\nMany thanks to [YourKit, LLC](https://www.yourkit.com/) for providing a free license\nof [YourKit Java Profiler](https://www.yourkit.com/java/profiler/index.jsp) to support the\ndevelopment of Easy Rules.\n\n## License\n\nEasy Rules is released under the terms of the MIT license:\n\n```\nThe MIT License (MIT)\n\nCopyright (c) 2021 Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvgaba%2Feasy-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvgaba%2Feasy-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvgaba%2Feasy-rules/lists"}