* Create a default rules engine and register the business rule
*/
RulesEngine rulesEngine = new DefaultRulesEngine();
rulesEngine.registerRule(rule);
/**
* Fire rules
*/
rulesEngine.fireRules();
}
}
```
`HelloWorldConditionTrigger` encapsulates the logic that checks if the user responded 'yes' to the question:
```java
public class HelloWorldConditionTrigger implements ConditionTrigger {
private String input;
public HelloWorldConditionTrigger(String input) {
this.input = input;
}
public boolean triggerCondition() {
//The rule should be applied only if the user's response is yes (duke friend)
return input.equalsIgnoreCase("yes");
}
}
```
`HelloWorldActionPerformer` encapsulates the logic of the action to perform when the condition is satisfied, in this sample, simply prints 'Hello duke's friend!' to the console:
```java
public class HelloWorldActionPerformer implements ActionPerformer {
@Override
public void performAction() {
System.out.println("Hello duke's friend!");
}
}
```
More samples of how to use Easy Rules can be found [here][].
## Roadmap
* Annotation support : Condition and Action can be defined in any POJO
* Spring support : Easy Rules should be easily configured and used in a Spring container
## License
Easy Rules is released under the [MIT License][].
## Contribution
Your feedback is highly appreciated! For any issue, please use the [issue tracker][].