[rules-users] MVEL and Maps

Mark Proctor mproctor at codehaus.org
Tue Nov 10 14:06:20 EST 2009


create declared types and then use a transformation tool to marshal 
those maps into the internal type declarations. You can look at the 
pipeline's jaxb and xstream for examples of how this works.

Mark
Leonardo Gomes wrote:
> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>   





More information about the rules-users mailing list