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);
}
}
Aggregations