Drools 不能对 DRL 中的函数参数使用泛型类型

Drools can not use a generic type for a function's parameter in DRL

我正在我的 DRL 上定义下一个函数

function void embargarMultiplesCuentasJudicial(ArrayList<Cuenta> cuentas, Embargo embargo,BigDecimal montoTotal ,BigDecimal limite) {
    //BODY
}

我收到这个错误:

Unable to resolve type ArrayList<Cuenta> while building function. java.lang.ClassNotFoundException: Unable to find class 'ArrayList<Cuenta>' ]]

但我正在导入顶部文件中的 ArrayList 和 Cuenta

import modelo.Cuenta;
import modelo.Embargo;
import java.util.ArrayList;

看来您不需要提及 ArrayList 在参数中使用的内容。以下示例对我来说效果很好(它是自定义对象的 ArrayList):

function testFunction(ArrayList al)
{
    System.err.println("Called a function with the ArrayList : " + java.util.Arrays.toString(al.toArray()));
}

解析器对具有泛型类型的参数失败,但可以在方法主体中省略类型和强制转换。

function void embargarMultiplesCuentasJudicial(List cuentas, Embargo embargo,BigDecimal montoTotal ,BigDecimal limite) {

    List<Cuenta> typedList = (List<Cuenta>) cuentas;

}