[rules-users] Creating HashMap object in rules

Esteban Aliverti esteban.aliverti at gmail.com
Mon Nov 5 08:35:00 EST 2012


According to java documentation the result of Map.put is:

"the previous value associated with key, or null if there was no mapping
for key. (A null return can also indicate that the map previously
associated null with key, if the implementation supports null values.)"

Are you sure that you are doing what you think you are doing when you do:
$testObj.getResult().add($rule.put(.....)) ?

Best Regards,


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com


On Mon, Nov 5, 2012 at 2:28 PM, himansu.nayak <himansumca at gmail.com> wrote:

> Hi,
> i m trying to do something like this.
>
> RHS OF MY RULE
> ================
> Map <String, String>$result = new HashMap<String, String>();
> Map <String, Map>$rule = new HashMap<String, Map>();
> $result.put("Result1", "@{Result1}");
> $result.put("Result2", "@{Result2}");
> $result.put("Result3", "@{Result3}");
> $testObj.getResult().add($rule.put(drools.getRule().getName(), $result));
> update($testObj.getResult());
>
> i am not able to get this 2 object i.e "result and rule" from my java code
> after the execution of the rule. even though i have the reference of
> testobj
> in my java code.
>
> did i miss anything?
>
>
>
> -----
> Thanks...
> Himansu
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Creating-HashMap-object-in-rules-tp4020690p4020700.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20121105/f01d6543/attachment.html 


More information about the rules-users mailing list