On 02/06/2011 15:24, Simon Chen wrote:
2011/6/2 Wolfgang Laun<wolfgang.laun(a)gmail.com>:
> On 1 June 2011 21:43, Simon Chen<simonchennj(a)gmail.com> wrote:
>> Hi all,
>>
>> I am always confused about what we can do in the "then" part of the
rule.
>>
>> In particular, I have problem duplicate a list. For example:
>>
>> when:
>> $b: Book( "james" memberOf authors )
>> then:
>> Test fact = new Test();
>> fact.getList().addAll( $b.authors );
>> insert(fact);
>> end
>>
>> The error message reads like this:
>>
>> BuildError: Unable to build expression for 'consequence': [Error:
>> Failed to compile: 2 compilation error(s):
>> - (1,7) unqualified type in strict mode for: $b
>> - (1,12) unqualified type in strict mode for: authors]
>>
>> What is the right way to do this?
> Granted - the error message is a puzzle in itself, but basically, the RHS
> must be written according to Java rules. Hence, if $b is an object of type
> Book, $b.authors depends on the (Java!) visibility of member authors. If it
> isn't public, you must use the getter.
I always have the variables "protected" and use public getters. For
other variables, $b.xxx just works, as long as getXxx() exists. But
for $b.authors, even if I have getAuthors() there, it still doesn't
work. That's why I'm suspecting something wrong with the list - the
only difference is that authors is an EList object...
Have you tried this with 5.2 CR1, lots of MVEL fixes.
Mark
Still don't know why...
-Simon
> -W
>
>> Thanks.
>> -Simon
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users