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) |
<T> Collector<T,?,S> |
asCollector()
A convenience method that returns an instance of
Collector for inserting
streams of facts. |
Object |
fire() |
ActivationManager |
getActivationManager() |
Knowledge |
getParentContext() |
default S |
insert(Iterable<?> objects)
Inserts a collection of facts.
|
default S |
insert(Object... objects)
Inserts an array of facts.
|
default FactHandle |
insert(Object fact)
Inserts a fact in working memory and returns a serializable fact handle.
|
default S |
insert(String type,
Collection<?> objects)
Deprecated.
|
default FactHandle |
insert(String type,
Object fact)
Deprecated.
|
FactHandle |
insert0(Object fact,
boolean resolveCollections)
Inserts a fact in working memory and returns a serializable fact handle.
|
FactHandle |
insert0(String type,
Object fact,
boolean resolveCollections)
Inserts a fact and explicitly specifies its
Type name. |
default S |
insertAs(String type,
Iterable<?> objects)
Inserts a collection of facts, marking them as being of a specific type.
|
default S |
insertAs(String type,
Object... objects)
Inserts a collection of facts, marking them as being of a specific type.
|
default FactHandle |
insertAs(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.
in favor of
setExecutionPredicate(BooleanSupplier) |
getActivationManagerFactory, getClassLoader, getConfiguration, getExpressionResolver, getRuleComparator, getService, getTypeResolver, newRule, newRule, setActivationManagerFactory, setActivationManagerFactory, setActivationMode, setClassLoader, setRuleComparator, wrapTypeResolveraddListener, removeListeneraddImport, addImport, getImports, getJavaImportssetget, get, getPropertyNamesaddEvaluator, addEvaluator, getEvaluator, replaceEvaluator, replaceEvaluatorcompileRule, getRule, getRule, getRules, resolveFieldReferences, ruleExistsdefault FactHandle insert(Object fact)
Inserts a fact in working memory and returns a serializable fact handle.
fact - object to insertNullPointerException - if argument is nullFactHandle<T> Collector<T,?,S> asCollector()
A convenience method that returns an instance of Collector for inserting
streams of facts.
@Deprecated default S setFireCriteria(BooleanSupplier criteria)
setExecutionPredicate(BooleanSupplier)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 supplier@Deprecated default FactHandle insert(String type, Object fact)
type - type namefact - fact to insertNullPointerException - if argument is nullinsertAs(String, Object)FactHandle insert0(Object fact, boolean resolveCollections)
Inserts a fact in working memory and returns a serializable fact handle.
When resolveCollections is set to true, and the fact is an Iterable
or an Array, the engine will instead insert its components and return a null FactHandle.
Together with the insert0(String, Object, boolean) method, this operation constitutes
the core insert operations that are actually implemented by the engine. The other insert
methods are just convenience wrappers of the two.
fact - object to insertresolveCollections - collection/array inspection flagnull if multiple facts were insertedNullPointerException - if argument is nullFactHandleFactHandle insert0(String type, Object fact, boolean resolveCollections)
Inserts a fact and explicitly specifies its Type name.
When resolveCollections is set to true, and the fact is an Iterable
or an Array, the engine will instead insert its components, and return a null FactHandle.
Together with the insert0(Object, boolean) method, this operation constitutes
the core insert operations that are actually implemented by the engine. The other insert
methods are just convenience wrappers of the two.
fact - object to insertresolveCollections - collection/array inspection flagtype - type namenull if multiple facts were insertedNullPointerException - if argument is nullFactHandledefault FactHandle insertAs(String type, Object fact)
Inserts a fact and explicitly specifies its Type name.
type - type namefact - fact to insertNullPointerException - if argument is null@Deprecated default S insert(String type, Collection<?> objects)
Inserts a collection of facts, marking them as being of a specific type.
type - type nameobjects - objects to insertinsertAs(String, Object)default S insertAs(String type, Iterable<?> objects)
Inserts a collection of facts, marking them as being of a specific type.
type - type nameobjects - objects to insertinsertAs(String, Object)default S insertAs(String type, Object... objects)
Inserts a collection of facts, marking them as being of a specific type.
type - type nameobjects - objects to insertinsertAs(String, Object)default S insert(Iterable<?> 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()
Object fire()
Copyright © 2021. All rights reserved.