EZ Rules


What EZ-Rules is?

EZ Rules is a lightweight Java framework that allow the users to design the project business logic as rules.

The framework use some ideas of some of the well know Rule frameworks to create a simple and easy to use library.

Some of the features available in the framework are:

  • Powerful Java API
  • Rules doesn’t depend of Rule super class, any java class can be a rule with the correct annotations
  • Rule grouping with different execution strategy patterns like (stop first run, or execute all)
  • Rules prioritization
  • Rule grouping
  • Generic Context Support, you can pass a set of context to the engine and define the parameters you want in you rules methods. The framework will resolve those parameters for you.

How it work

Declare your Rule

You can convert almost every POJO into a rule, those are the restrictions:

  • The POJO need to have the @Rule annotation
  • The POJO need to have a method for the precondition annotated with @When annotation this method could have any number of parameters (see documentation for details of how the parameters are resolved) and should return one of the following values:
    • boolean
    • Boolean
    • WhenEnum
  • The POJO should have a void method annotated with @Then and any number of parameters (see documentation for details of how the parameters are resolved)

Rule sample:

Executing the rules

An special class was build to manage the application rules, this class was names RulesEngine. The engine class allow you to register @Rules, @Callback, @Group, Exchange classes. For more information look in the documentation.

Rule engine sample:


Full documentation: EZ-Rules @ Opnitech

Repository: EZ-Rules @ GitHub

Releases: EZ-Rules Releases @ GitHub

Continuous integration: Build Jenkins job @ CloudBees

Licensing: MIT License


One thought on “EZ Rules”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">