public interface RuleSession<S extends RuleSession<S>> extends RuntimeContext<S>, RuleSet<RuntimeRule>
Base interface for both stateful and stateless sessions
SALIENCE_COMPARATOR| Modifier and Type | Method and Description |
|---|---|
S |
addEventListener(SessionLifecycleListener listener) |
ActivationManager |
getActivationManager() |
Knowledge |
getParentContext() |
default S |
insert(Collection<?> objects)
Inserts a collection of facts.
|
default S |
insert(Object... objects)
Inserts an array of facts.
|
FactHandle |
insert(Object fact)
Inserts a fact in working memory and returns a serializable fact handle.
|
default S |
insert(String type,
Collection<?> objects)
Inserts a collection of facts, marking them as being of a specific type.
|
FactHandle |
insert(String type,
Object fact)
Inserts a fact and explicitly specifies its
Type name. |
S |
removeEventListener(SessionLifecycleListener listener) |
S |
setActivationManager(ActivationManager activationManager) |
S |
setExecutionPredicate(BooleanSupplier criteria)
Session call's the supplier's
BooleanSupplier.getAsBoolean() method prior to each
activation cycle. |
default S |
setFireCriteria(BooleanSupplier criteria)
Deprecated.
|
getActivationManagerFactory, getClassLoader, getConfiguration, getExpressionResolver, getRuleComparator, getService, getTypeResolver, newRule, newRule, setActivationManagerFactory, setActivationManagerFactory, setActivationMode, setClassLoader, setRuleComparator, wrapTypeResolveraddListener, removeListeneraddImport, addImport, getImports, getJavaImportssetget, get, getPropertyNamesaddEvaluator, addEvaluator, replaceEvaluatorcompileRule, getRule, getRule, getRules, ruleExistsFactHandle insert(Object fact)
Inserts a fact in working memory and returns a serializable fact handle.
fact - object to insertNullPointerException - if argument is nullFactHandle@Deprecated default S setFireCriteria(BooleanSupplier criteria)
setExecutionPredicate(BooleanSupplier) instead.S setExecutionPredicate(BooleanSupplier criteria)
Session call's the supplier's BooleanSupplier.getAsBoolean() method prior to each
activation cycle. If the provided value is false then the cycle gets interrupted
and session exits its fire(...) method.
Along with the ActivationManager, this method can be used to debug rules, to avoid infinite
activation loops, or to prevent excessive consumption of computer resources.
criteria - - boolean value supplierFactHandle insert(String type, Object fact)
Inserts a fact and explicitly specifies its Type name.
type - type namefact - fact to insertNullPointerException - if argument is nulldefault S insert(String type, Collection<?> objects)
Inserts a collection of facts, marking them as being of a specific type.
type - type nameobjects - objects to insertinsert(String, Object)default S insert(Collection<?> objects)
Inserts a collection of facts.
objects - objects to insertinsert(Object)default S insert(Object... objects)
Inserts an array of facts.
objects - objects to insertinsert(Object)ActivationManager getActivationManager()
S setActivationManager(ActivationManager activationManager)
S addEventListener(SessionLifecycleListener listener)
S removeEventListener(SessionLifecycleListener listener)
Knowledge getParentContext()
Copyright © 2021. All rights reserved.