Search in sources :

Example 6 with EvaluatorDefinition

use of org.drools.compiler.rule.builder.EvaluatorDefinition in project drools by kiegroup.

the class EvaluatorRegistry method addEvaluatorDefinition.

/**
 * Adds an evaluator definition class to the registry using the
 * evaluator class name. The class will be loaded and the corresponting
 * evaluator ID will be added to the registry. In case there exists
 * an implementation for that ID already, the new implementation will
 * replace the previous one.
 *
 * @param className the name of the class for the implementation definition.
 *                  The class must implement the EvaluatorDefinition interface.
 */
public void addEvaluatorDefinition(String className) {
    try {
        Class<EvaluatorDefinition> defClass = (Class<EvaluatorDefinition>) this.classloader.loadClass(className);
        EvaluatorDefinition def = defClass.newInstance();
        addEvaluatorDefinition(def);
    } catch (ClassNotFoundException e) {
        throw new RuntimeException("Class not found for evaluator definition: " + className, e);
    } catch (InstantiationException e) {
        throw new RuntimeException("Error instantiating class for evaluator definition: " + className, e);
    } catch (IllegalAccessException e) {
        throw new RuntimeException("Illegal access instantiating class for evaluator definition: " + className, e);
    }
}
Also used : EvaluatorDefinition(org.drools.compiler.rule.builder.EvaluatorDefinition)

Aggregations

EvaluatorDefinition (org.drools.compiler.rule.builder.EvaluatorDefinition)6 AfterEvaluatorDefinition (org.drools.mvel.evaluators.AfterEvaluatorDefinition)2 BeforeEvaluatorDefinition (org.drools.mvel.evaluators.BeforeEvaluatorDefinition)2 DescrBuildError (org.drools.compiler.compiler.DescrBuildError)1 PatternBuilder.registerDescrBuildError (org.drools.compiler.rule.builder.PatternBuilder.registerDescrBuildError)1 ReteEvaluator (org.drools.core.common.ReteEvaluator)1 Evaluator (org.drools.core.spi.Evaluator)1 InternalReadAccessor (org.drools.core.spi.InternalReadAccessor)1 DisconnectedWorkingMemoryEntryPoint (org.drools.kiesession.entrypoints.DisconnectedWorkingMemoryEntryPoint)1 CoincidesEvaluatorDefinition (org.drools.mvel.evaluators.CoincidesEvaluatorDefinition)1 DuringEvaluatorDefinition (org.drools.mvel.evaluators.DuringEvaluatorDefinition)1 FinishedByEvaluatorDefinition (org.drools.mvel.evaluators.FinishedByEvaluatorDefinition)1 FinishesEvaluatorDefinition (org.drools.mvel.evaluators.FinishesEvaluatorDefinition)1 IncludesEvaluatorDefinition (org.drools.mvel.evaluators.IncludesEvaluatorDefinition)1 MeetsEvaluatorDefinition (org.drools.mvel.evaluators.MeetsEvaluatorDefinition)1 MetByEvaluatorDefinition (org.drools.mvel.evaluators.MetByEvaluatorDefinition)1 OverlappedByEvaluatorDefinition (org.drools.mvel.evaluators.OverlappedByEvaluatorDefinition)1 OverlapsEvaluatorDefinition (org.drools.mvel.evaluators.OverlapsEvaluatorDefinition)1 StartedByEvaluatorDefinition (org.drools.mvel.evaluators.StartedByEvaluatorDefinition)1 StartsEvaluatorDefinition (org.drools.mvel.evaluators.StartsEvaluatorDefinition)1