Drools 规则中的映射和字符串

发布于 2024-10-02 17:52:36 字数 656 浏览 4 评论 0原文

我有以下 Drools 规则,我将填充有 element 的 map 发送到该规则,但是当它执行时,我有 element 。为什么值应该是“Y”时却得到 null?当我在 ACDebug.debug() 方法中放置断点并在执行 $map.put() 后检查地图时,它看起来不错,它的值是“Y”,但在我的规则执行后,我有 null?有人有类似的问题吗?

import java.util.Map;
import java.util.HashMap;
import edu.abc.ACDebug;

rule "POSTPROCESSOR 8"
    ruleflow-group "supress-processor"
    when
        $map:Map(keySet contains "STANDARD_ADDRESS:STREET_NAME")
    then
        ACDebug.debug($map, "Map before PUT: ");
        $map.put("/locationList/sourceAddress/fullStreet",new String("Y"));
        ACDebug.debug($map, "Map after PUT: ");
        $map.remove("STANDARD_ADDRESS:STREET_NAME");
end

I have following Drools rule to which I send map filled with element , but when it gets executed I have element . Why do I get null when it should be "Y" for the value? When I put breakpoint in ACDebug.debug() method and inspect map after $map.put() was executed it looks good, it has "Y" for the value, but after my rules get executed I have null? Has anyone have similar problem?

import java.util.Map;
import java.util.HashMap;
import edu.abc.ACDebug;

rule "POSTPROCESSOR 8"
    ruleflow-group "supress-processor"
    when
        $map:Map(keySet contains "STANDARD_ADDRESS:STREET_NAME")
    then
        ACDebug.debug($map, "Map before PUT: ");
        $map.put("/locationList/sourceAddress/fullStreet",new String("Y"));
        ACDebug.debug($map, "Map after PUT: ");
        $map.remove("STANDARD_ADDRESS:STREET_NAME");
end

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苯莒 2024-10-09 17:52:36

对地图进行更改后,您需要进行更新。这让工作记忆知道您修改了地图。

添加以下行:

update( $map );

After you have done the changes to the map, you need to do an update. This lets the working memory know that you modified the map.

Add the following line:

update( $map );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文