[rules-users] Condition syntax to access Map

bolsover david at bolsover.com
Wed Jul 27 14:45:38 EDT 2011


I'm struggling with the syntax to access a mapped object - hoping that
someone can help with this..

I have the following condition in a rule:

$a : Answer(getAnswerData().get(0).getValue_str() == "Valves")

Answer is a pojo where answerData is a Map<Integer, AnswerData>
object.
AnswerData is also a pojo and has a String variable value_str.

Rule containing this condition complies but I get the following error when I
fireAllRules

[Error: null pointer or function not found: getValue_str]
[Near : {... getAnswerData().get(0).getValu ....}]
             ^
[Line: 1, Column: 1]

org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:997)

The method getValue_str() does exist in AnswerData as does getAnswerData()
in Answer and there are not any null values.

I'm assuming that autoboxing will correctly interpret .get(0) as an Integer
object.


Any ideas??







--
View this message in context: http://drools.46999.n3.nabble.com/Condition-syntax-to-access-Map-tp3204429p3204429.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list