java.lang.Object
org.evrete.util.KnowledgeWrapper
- All Implemented Interfaces:
Environment,EventBus,FluentEnvironment<Knowledge>,FluentImports<Knowledge>,Knowledge,Named,RuleSet<RuleDescriptor>,RuleSetContext<Knowledge,,RuleDescriptor> RuntimeContext<Knowledge>
KnowledgeWrapper is an abstract class that delegates the knowledge's
methods to a provided delegate object.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an import statement using its string representation.builder(ClassLoader classLoader) Returns an instance ofRuleSetBuilderfor building and appending rules to the current context.configureTypes(Consumer<TypeResolver> action) Configures theTypeResolverby applying the given action.<T> TRetrieves the value of a property by its name.Class<? extends ActivationManager>Returns the Activation Manager factory class for this RuntimeContext.Retrieves the ClassLoader used by the current context.Retrieves the Configuration object associated with this RuntimeContext.Return the condition manager associated with this context.Retrieves the current set of import statements.getName()Returns the name of the object.Retrieves a collection of all property names in the environment.<E extends ContextEvent>
Events.Publisher<E>getPublisher(Class<E> eventClass) Returns a publisher for a specific event class type.final RuleDescriptorRetrieves a rule based on its name.Retrieves the comparator used for ordering rules.final List<RuleDescriptor>getRules()Method returns a list of rules created so far.Returns theKnowledgeServiceinstance.Retrieves a collection of active RuleSessions associated with the Knowledge.Retrieves the TypeResolver instance associated with this RuntimeContext.protected Knowledgeself()Sets the specified property to the given value.<A extends ActivationManager>
voidsetActivationManagerFactory(Class<A> managerClass) Sets the Activation Manager factory class for this RuntimeContext.voidsetActivationManagerFactory(String managerClass) Sets the Activation Manager factory class name for this RuntimeContext.setActivationMode(ActivationMode activationMode) Sets the activation mode for the session.voidsetRuleComparator(Comparator<Rule> comparator) Sets the comparator used for ordering rules.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.evrete.api.Environment
get, get, getPropertyNamesMethods inherited from interface org.evrete.api.events.EventBus
getPublisher, subscribe, subscribe, subscribeAsyncMethods inherited from interface org.evrete.api.FluentEnvironment
setMethods inherited from interface org.evrete.api.FluentImports
addImport, addImport, getImports, getJavaImportsMethods inherited from interface org.evrete.api.Knowledge
activationManager, newStatefulSession, newStatelessSessionMethods inherited from interface org.evrete.api.RuleSet
getRule, getRule, getRules, ruleExistsMethods inherited from interface org.evrete.api.RuntimeContext
builder, builder, configureTypes, getActivationManagerFactory, getClassLoader, getConfiguration, getEvaluatorsContext, getRuleComparator, getService, getTypeResolver, importRules, importRules, setActivationManagerFactory, setActivationManagerFactory, setActivationMode, setRuleComparator
-
Field Details
-
delegate
-
-
Constructor Details
-
KnowledgeWrapper
-
-
Method Details
-
getSessions
Description copied from interface:KnowledgeRetrieves a collection of active RuleSessions associated with the Knowledge.- Specified by:
getSessionsin interfaceKnowledge- Returns:
- a collection of RuleSessions
-
newStatefulSession
- Specified by:
newStatefulSessionin interfaceKnowledge- Returns:
- new stateful session
-
newStatelessSession
- Specified by:
newStatelessSessionin interfaceKnowledge- Returns:
- new stateless session
-
get
Description copied from interface:EnvironmentRetrieves the value of a property by its name.- Specified by:
getin interfaceEnvironment- Type Parameters:
T- The expected type of the property value.- Parameters:
property- The name of the property to retrieve.- Returns:
- The value of the property as type T, or
nullif it does not exist.
-
getPropertyNames
Description copied from interface:EnvironmentRetrieves a collection of all property names in the environment.- Specified by:
getPropertyNamesin interfaceEnvironment- Returns:
- A collection of strings representing all property names in the environment.
-
getName
Description copied from interface:NamedReturns the name of the object. -
getRule
Description copied from interface:RuleSetRetrieves a rule based on its name.- Specified by:
getRulein interfaceRuleSet<D extends RuleSetContext<C,R>> - Parameters:
name- the name of the rule to retrieve- Returns:
- the rule with the specified name, or null if no rule with that name exists
-
set
Description copied from interface:FluentEnvironmentSets the specified property to the given value.- Specified by:
setin interfaceEnvironment- Specified by:
setin interfaceFluentEnvironment<D extends RuleSetContext<C,R>> - Parameters:
property- the name of the property to set; should not benull.value- the new value for the property; the actual type is determined by the implementation and the property being set.- Returns:
- the current instance of
Xto allow for method chaining.
-
getPublisher
Description copied from interface:EventBusReturns a publisher for a specific event class type.- Specified by:
getPublisherin interfaceEventBus- Type Parameters:
E- the type of the event to publish- Parameters:
eventClass- the class object of the event type- Returns:
- an
Events.Publisherfor the specified event class type - See Also:
-
configureTypes
Description copied from interface:RuntimeContextConfigures theTypeResolverby applying the given action.- Specified by:
configureTypesin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Parameters:
action- the action to configure the TypeResolver- Returns:
- this context
-
self
-
addImport
Description copied from interface:FluentImportsAdds an import statement using its string representation.- Specified by:
addImportin interfaceFluentImports<D extends RuleSetContext<C,R>> - Parameters:
imp- the full canonical name of the class or package to be imported- Returns:
- this instance to allow for method chaining
-
getRules
Description copied from interface:RuleSetMethod returns a list of rules created so far.
- Specified by:
getRulesin interfaceRuleSet<D extends RuleSetContext<C,R>> - Returns:
- list of currently known rules
-
getImports
Description copied from interface:FluentImportsRetrieves the current set of import statements.- Specified by:
getImportsin interfaceFluentImports<D extends RuleSetContext<C,R>> - Returns:
- an
Importsobject containing the current set of import statements
-
getRuleComparator
Description copied from interface:RuntimeContextRetrieves the comparator used for ordering rules.- Specified by:
getRuleComparatorin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Returns:
- the comparator for Rule objects.
-
setRuleComparator
Description copied from interface:RuntimeContextSets the comparator used for ordering rules.- Specified by:
setRuleComparatorin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Parameters:
comparator- the comparator for Rule objects.
-
builder
Description copied from interface:RuntimeContextReturns 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- Specified by:
builderin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Parameters:
classLoader- the classloader to use.- Returns:
- new instance of RuleSetBuilder.
-
setActivationMode
Description copied from interface:RuntimeContextSets the activation mode for the session.- Specified by:
setActivationModein interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Parameters:
activationMode- the activation mode to set- Returns:
- the updated instance of the class
-
getEvaluatorsContext
Description copied from interface:RuntimeContextReturn the condition manager associated with this context.- Specified by:
getEvaluatorsContextin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Returns:
- the evaluator context
-
getClassLoader
Description copied from interface:RuntimeContextRetrieves the ClassLoader used by the current context.- Specified by:
getClassLoaderin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Returns:
- the ClassLoader used by the object.
-
getService
Description copied from interface:RuntimeContextReturns theKnowledgeServiceinstance.- Specified by:
getServicein interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Returns:
- the
KnowledgeServiceinstance
-
getActivationManagerFactory
Description copied from interface:RuntimeContextReturns the Activation Manager factory class for this RuntimeContext.- Specified by:
getActivationManagerFactoryin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Returns:
- the Activation Manager factory class
-
setActivationManagerFactory
Description copied from interface:RuntimeContextSets the Activation Manager factory class for this RuntimeContext.- Specified by:
setActivationManagerFactoryin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Type Parameters:
A- the type of Activation Manager- Parameters:
managerClass- the Activation Manager factory class
-
setActivationManagerFactory
Description copied from interface:RuntimeContextSets the Activation Manager factory class name for this RuntimeContext.- Specified by:
setActivationManagerFactoryin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Parameters:
managerClass- the Activation Manager factory class name
-
getTypeResolver
Description copied from interface:RuntimeContextRetrieves the TypeResolver instance associated with this RuntimeContext.- Specified by:
getTypeResolverin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Returns:
- the TypeResolver instance
-
getConfiguration
Description copied from interface:RuntimeContextRetrieves the Configuration object associated with this RuntimeContext.- Specified by:
getConfigurationin interfaceRuntimeContext<D extends RuleSetContext<C,R>> - Returns:
- the Configuration object
-