- Type Parameters:
C- the type of the implementing class or interface
- All Superinterfaces:
Environment,EvaluationListeners,EvaluatorsContext,FluentEnvironment<C>,FluentImports<C>
- All Known Subinterfaces:
Knowledge,RuleSession<S>,RuleSetContext<C,,R> StatefulSession,StatelessSession
- All Known Implementing Classes:
AbstractSessionWrapper,KnowledgeWrapper
public interface RuntimeContext<C extends RuntimeContext<C>>
extends FluentImports<C>, FluentEnvironment<C>, EvaluatorsContext
The RuntimeContext interface represents the context in which the rules are executed.
Both stateful and stateless sessions, as well as
Knowledge instances, extend this interface.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Returns an instance ofRuleSetBuilderfor building and appending rules to the current context.compile(Collection<LiteralExpression> expressions) A convenience method for compiling literal expressions.default LiteralEvaluatorcompile(LiteralExpression expression) configureTypes(Consumer<TypeResolver> action) Configures theTypeResolverby applying the given action.Class<? extends ActivationManager>newRule()Deprecated.this method is deprecated in favor of a more efficient way of building rules, especially for large rule sets.Deprecated.this method is deprecated in favor of a more efficient way of building rules, especially for large rule sets.<A extends ActivationManager>
voidsetActivationManagerFactory(Class<A> managerClass) voidsetActivationManagerFactory(String managerClass) setActivationMode(ActivationMode activationMode) voidsetClassLoader(ClassLoader classLoader) Sets new parent classloader for this context's internal classloader.voidsetRuleComparator(Comparator<Rule> comparator) voidwrapTypeResolver(TypeResolverWrapper wrapper) Deprecated.This class is deprecated and will be removed in future releases.Methods inherited from interface org.evrete.api.Environment
get, get, getPropertyNamesMethods inherited from interface org.evrete.api.EvaluationListeners
addListener, removeListenerMethods inherited from interface org.evrete.api.EvaluatorsContext
addEvaluator, addEvaluator, getEvaluator, replaceEvaluator, replaceEvaluatorMethods inherited from interface org.evrete.api.FluentEnvironment
setMethods inherited from interface org.evrete.api.FluentImports
addImport, addImport, getImports, getJavaImports
-
Field Details
-
SALIENCE_COMPARATOR
-
-
Method Details
-
getRuleComparator
Comparator<Rule> getRuleComparator() -
setRuleComparator
-
newRule
Deprecated.this method is deprecated in favor of a more efficient way of building rules, especially for large rule sets. See the newbuilder()method for detailsCreates a new rule with the provided name.- Parameters:
name- rule name- Returns:
- a new rule builder
-
newRule
Deprecated.this method is deprecated in favor of a more efficient way of building rules, especially for large rule sets. Seebuilder()for detailsCreates a new unnamed rule.- Returns:
- a new rule builder
-
builder
RuleSetBuilder<C> builder()Returns an instance of
RuleSetBuilderfor building and appending rules to the current context.Builder MUST be terminated with the
RuleSetBuilder.build()call for changes to take effect.Usage BEFORE 3.1.00:
Usage AFTER 3.1.00:service .newKnowledge() .newRule() .forEach("$a", A.class) .where("$a.active") .execute();service .newKnowledge() .builder() // !! important .newRule() .forEach("$a", A.class) .where("$a.active") .execute() .build(); // !! important- Returns:
- new instance of RuleSetBuilder.
- Since:
- 3.1.00
-
compile
- Parameters:
expression- literal condition and its context- Returns:
- new evaluator instance
- Throws:
CompilationException- if the expression failed to compile- See Also:
-
compile
Collection<LiteralEvaluator> compile(Collection<LiteralExpression> expressions) throws CompilationException A convenience method for compiling literal expressions.
- Parameters:
expressions- literal conditions and their context- Returns:
- compiled literal conditions
- Throws:
CompilationException- if the expression failed to compile
-
wrapTypeResolver
Deprecated.This class is deprecated and will be removed in future releases. Use theconfigureTypes(Consumer)method instead to configure the context's types and their fields.Wraps the provided TypeResolver with a TypeResolverWrapper instance.- Parameters:
wrapper- the TypeResolverWrapper instance used to wrap the TypeResolver
-
setActivationMode
-
getExpressionResolver
ExpressionResolver getExpressionResolver() -
configureTypes
Configures theTypeResolverby applying the given action.- Parameters:
action- the action to configure the TypeResolver- Returns:
- this context
-
getClassLoader
ClassLoader getClassLoader() -
setClassLoader
Sets new parent classloader for this context's internal classloader.
- Parameters:
classLoader- this context's new parent classloader
-
getService
KnowledgeService getService() -
getActivationManagerFactory
Class<? extends ActivationManager> getActivationManagerFactory() -
setActivationManagerFactory
-
setActivationManagerFactory
-
getTypeResolver
TypeResolver getTypeResolver() -
getConfiguration
Configuration getConfiguration() -
getSourceCompiler
JavaSourceCompiler getSourceCompiler()
-