diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/Action.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/Action.java index 368c5b90..419803c9 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/Action.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/Action.java @@ -23,13 +23,15 @@ */ package org.jeasy.rules.api; +import java.io.Serializable; + /** * This interface represents a rule's action. * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) */ @FunctionalInterface -public interface Action { +public interface Action extends Serializable { /** * Execute the action when the rule's condition evaluates to true. diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/Condition.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/Condition.java index bdd66d24..125e7eaf 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/Condition.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/Condition.java @@ -23,13 +23,15 @@ */ package org.jeasy.rules.api; +import java.io.Serializable; + /** * This interface represents a rule's condition. * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) */ @FunctionalInterface -public interface Condition { +public interface Condition extends Serializable { /** * Evaluate the condition according to the known facts. diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/Fact.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/Fact.java index 3e23622f..8ad3f41a 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/Fact.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/Fact.java @@ -23,6 +23,7 @@ */ package org.jeasy.rules.api; +import java.io.Serializable; import java.util.Objects; /** @@ -32,7 +33,7 @@ * @param type of the fact * @author Mahmoud Ben Hassine */ -public class Fact { +public class Fact implements Serializable { private final String name; private final T value; diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/Facts.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/Facts.java index 28e4d658..11cb43a0 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/Facts.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/Facts.java @@ -23,6 +23,7 @@ */ package org.jeasy.rules.api; +import java.io.Serializable; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -36,7 +37,7 @@ * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) */ -public class Facts implements Iterable> { +public class Facts implements Iterable>, Serializable { private final Set> facts = new HashSet<>(); diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/Rule.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/Rule.java index 1587281d..33f84ddb 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/Rule.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/Rule.java @@ -23,6 +23,8 @@ */ package org.jeasy.rules.api; +import java.io.Serializable; + /** * Abstraction for a rule that can be fired by a rules engine. * @@ -31,7 +33,7 @@ * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) */ -public interface Rule extends Comparable { +public interface Rule extends Comparable, Serializable { /** * Default rule name. diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/RuleListener.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/RuleListener.java index 94bb1de6..f295de3f 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/RuleListener.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/RuleListener.java @@ -23,12 +23,14 @@ */ package org.jeasy.rules.api; +import java.io.Serializable; + /** * A listener for rule execution events. * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) */ -public interface RuleListener { +public interface RuleListener extends Serializable { /** * Triggered before the evaluation of a rule. diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/Rules.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/Rules.java index 98a1607a..b2c70257 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/Rules.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/Rules.java @@ -25,6 +25,7 @@ import org.jeasy.rules.core.RuleProxy; +import java.io.Serializable; import java.util.Collections; import java.util.Iterator; import java.util.Objects; @@ -41,7 +42,7 @@ * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) */ -public class Rules implements Iterable { +public class Rules implements Iterable, Serializable { private Set rules = new TreeSet<>(); diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/RulesEngineListener.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/RulesEngineListener.java index dc48e843..45850242 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/RulesEngineListener.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/RulesEngineListener.java @@ -25,12 +25,14 @@ import org.jeasy.rules.core.InferenceRulesEngine; +import java.io.Serializable; + /** * A listener for rules engine execution events. * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) */ -public interface RulesEngineListener { +public interface RulesEngineListener extends Serializable { /** * Triggered before evaluating the rule set. diff --git a/easy-rules-core/src/main/java/org/jeasy/rules/api/RulesEngineParameters.java b/easy-rules-core/src/main/java/org/jeasy/rules/api/RulesEngineParameters.java index 0b147e49..f11ba38c 100644 --- a/easy-rules-core/src/main/java/org/jeasy/rules/api/RulesEngineParameters.java +++ b/easy-rules-core/src/main/java/org/jeasy/rules/api/RulesEngineParameters.java @@ -26,6 +26,8 @@ import org.jeasy.rules.core.DefaultRulesEngine; import org.jeasy.rules.core.InferenceRulesEngine; +import java.io.Serializable; + /** * Parameters of a rules engine. * @@ -36,13 +38,13 @@ * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) */ -public class RulesEngineParameters { +public class RulesEngineParameters implements Serializable { /** * Default rule priority threshold. */ public static final int DEFAULT_RULE_PRIORITY_THRESHOLD = Integer.MAX_VALUE; - + /** * Parameter to skip next applicable rules when a rule is applied. */ @@ -73,10 +75,10 @@ public RulesEngineParameters() { /** * Create a new {@link RulesEngineParameters}. * - * @param skipOnFirstAppliedRule parameter to skip next applicable rules on first applied rule. - * @param skipOnFirstFailedRule parameter to skip next applicable rules on first failed rule. + * @param skipOnFirstAppliedRule parameter to skip next applicable rules on first applied rule. + * @param skipOnFirstFailedRule parameter to skip next applicable rules on first failed rule. * @param skipOnFirstNonTriggeredRule parameter to skip next applicable rules on first non triggered rule. - * @param priorityThreshold threshold after which rules should be skipped. + * @param priorityThreshold threshold after which rules should be skipped. */ public RulesEngineParameters(final boolean skipOnFirstAppliedRule, final boolean skipOnFirstFailedRule, final boolean skipOnFirstNonTriggeredRule, final int priorityThreshold) { this.skipOnFirstAppliedRule = skipOnFirstAppliedRule;