[rules-users] Trouble with the MVEL Map syntax

Wolfgang Laun wolfgang.laun at gmail.com
Wed Mar 21 16:44:54 EDT 2012


It compiles without indicating an error.

2012/3/21 Mark Proctor <mproctor at codehaus.org>

>  On 21/03/2012 20:37, Wolfgang Laun wrote:
>
> Yes, I was quite surprised when the DRL compilation accepted the MVEL-ishly
> written function with dialect "mvel" preceding it. I thought that there
> was some
> undocumented development. So, why does it go the way it does?
>
> I dont' think it does. All we do is slurp in the text and pass it to the
> JDT compiler. So I doubt the the code below works. i'm looking at the
> JavaFunctionBuilder, I don't see any pre-processors that would enable those
> inline maps to work.
>
> Mark
>
>
> -W
>
> On 21 March 2012 21:32, Mark Proctor <mproctor at codehaus.org> wrote:
>
>> functions can only be written in Java.
>>
>> There is no support for MVEL dialect in functions.
>>
>> Mark
>> On 21/03/2012 03:37, barnesjd wrote:
>> > Correction.... I didn't paste the whole function the second time.  I do
>> have
>> > a return for the else...
>> >
>> > /function int englishToInt(String englishNumber)
>> > {
>> >       Map m = ["one":1, "two":2, "three":3, "four":4, "five":5];
>> >       Object obj = m.get(englishNumber.toLowerCase());
>> >
>> >       if(obj != null)
>> >               return Integer.parseInt(obj.toString());
>> >       else
>> >               return -1;
>> > }/
>> >
>> >
>> > --
>> > View this message in context:
>> http://drools.46999.n3.nabble.com/Trouble-with-the-MVEL-Map-syntax-tp3844609p3844617.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
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> 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/20120321/19d52298/attachment.html 


More information about the rules-users mailing list