Git Product home page Git Product logo

easyrules's Introduction

What is Easy Rules?

Easy Rules is a Java rules engine inspired by an article called "Should I use a Rules Engine?" of Martin Fowler in which Martin says:

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.

This is exactly what Easy Rules does, it provides the Rule abstraction to create rules with conditions and actions, and the RulesEngine API that runs through a set of rules to evaluate conditions and execute actions.

Core features

  • Lightweight library and easy to learn API
  • POJO based development with annotation programming model
  • Useful abstractions to define business rules and apply them easily with Java
  • The ability to create composite rules from primitive ones

Example

First, define your rule..
@Rule(name = "my awesome rule" )
public class MyRule {

    @Condition
    public boolean when() {
        return true;
    }
    
    @Action
    public void then() {
        System.out.println("Easy Rules rocks!");
    }
}
Then, fire it!
public class Test {
    public static void main(String[] args) {
        // create a rules engine
        RulesEngine rulesEngine = aNewRulesEngine().build();
        //register the rule
        rulesEngine.registerRule(new MyRule());
        //fire rules
        rulesEngine.fireRules();
    }
}

This is the hello world of Easy Rules. You can find other examples like the FizzBuzz tutorial in the documentation.

Quick links

Item Link
Project Home http://www.easyrules.org
Presentation https://speakerdeck.com/benas/easy-rules
Continuous integration Build job @ Travis CI
Agile Board Backlog items @ waffle.io
Code coverage Coverage
Sonar analysis Quality Gate

Current version

  • The current stable version is 2.4.0 : Maven Central
  • The current development version is 2.4.1-SNAPSHOT : Build Status

In order to use snapshot versions, you need to add the following maven repository in your pom.xml:

<repository>
    <id>ossrh</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>

Contribution

You are welcome to contribute to the project with pull requests on GitHub.

If you found a bug or want to request a feature, please use the issue tracker.

For any further question, you can use the Gitter channel of the project.

Awesome contributors

Thank you all for your contributions!

Acknowledgments

YourKit Travis CI
YourKit Java Profiler Travis CI
Many thanks to YourKit, LLC for providing a free license of YourKit Java Profiler to kindly support the development of Easy Rules. Many thanks to Travis CI for providing a free continuous integration service for open source projects.

License

Easy Rules is released under the MIT license.

The MIT License (MIT)

Copyright (c) 2017 Mahmoud Ben Hassine ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

easyrules's People

Contributors

drem-darios avatar fmbenhassine avatar gitter-badger avatar gs-spadmanabhan avatar jordanjennings avatar richdouglasevans avatar toudidel avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.