[rules-users] MVEL and Maps

Wolfgang Laun wolfgang.laun at gmail.com
Sun Nov 8 04:56:07 EST 2009


On Sat, Nov 7, 2009 at 6:00 PM, Leonardo Gomes
<leonardo.f.gomes at gmail.com>wrote:

> Hello,
>
> I'm feeding my working memory with Maps (unfortunately, this is a
> requirement and I can't use beans).
>
>
Before people start racking their brains to overcome all the resulting
difficulties: Could you please explain what this requirement is meant to
achieve?
-W



> 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.
> _______________________________________________
> 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/20091108/8ce7d57b/attachment.html 


More information about the rules-users mailing list