[rules-users] MVEL and Maps

Leonardo Gomes leonardo.f.gomes at gmail.com
Sat Nov 7 12:00:04 EST 2009


Hello,

I'm feeding my working memory with Maps (unfortunately, this is a
requirement and I can't use beans).

To access the values in this maps I use the following MVEL expression :

		Map ( this["airportCode"] == "GIG"
			, this["numberOfPassengers"] > "1"
			, this["class"] memberOf ("BUSINESS", "FIRST") )

And it works fine, except for dates where I get a ClassCastException,
even tough I'm using the right pattern:

Map ( this["departureDate"] > "07-Nov-2009" )   --- fails

Is there anything I need to do to make the dynamic cast of dates work,
in this particular case?

--

Morever, I get NPEs if there's no value for a given key. For example,
the expression Map ( this ["name"] == 'Leonardo' ) would fail if
there's no entry with "name" as the key.

Any help is welcome!

Thanks in advance,
Leo.



More information about the rules-users mailing list