Drools 6.5编译引用地图的规则时出错

时间:2017-08-23 09:40:03

标签: drools

我正在尝试编译以下规则并收到错误The method concatenateValues(String, String, String) in the type StringHelper is not applicable for the arguments (Object, Object, Object)。我的问题是为什么$ map.get(“KEY_B”),..不返回String值?

rule "RULE01"   
    no-loop true
    when
        $attribute:String()
        $map : Map(this["KEY_A"] == "VALUE_A")
    then
        ruleResponse.put("ruleName",drools.getRule().getName());
        $attribute = StringHelper.concatenateValues($map.get("KEY_B"),$map.get("KEY_C"), $map.get("KEY_D"));
        ruleResponse.put("result",$attribute);
end


public static String concatenateValues(Object value1, Object value2, Object value3){
        StringBuilder sb = new StringBuilder(value1 == null ? "" : value1.toString())
                                     .append(value2 == null ? "" : value2.toString())
                                     .append(value3 == null ? "" : value3.toString());
        return sb.toString();
    }

1 个答案:

答案 0 :(得分:1)

Drools不了解泛型类型。 get的结果具有类型@Configuration public class SpringMongoDbConfig { @Bean public Module registerGeoJsonModule(){ return new GeoJsonModule(); } }

您可以修改new AlertDialog.Builder(this).setView(input).setPositiveButton("ENTER", new DialogInterface.OnClickListener() { public void onClick(DialogInterface di,int id) { output.setText(input.getText().toString()); } } ) .create().show(); 以便按此操作:

Object