On 1 June 2011 21:43, Simon Chen <span dir="ltr"><<a href="mailto:simonchennj@gmail.com">simonchennj@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
I am always confused about what we can do in the "then" part of the rule.<br>
<br>
In particular, I have problem duplicate a list. For example:<br>
<br>
when:<br>
$b: Book( "james" memberOf authors )<br>
then:<br>
Test fact = new Test();<br>
fact.getList().addAll( $b.authors );<br>
insert(fact);<br>
end<br>
<br>
The error message reads like this:<br>
<br>
BuildError: Unable to build expression for 'consequence': [Error:<br>
Failed to compile: 2 compilation error(s):<br>
- (1,7) unqualified type in strict mode for: $b<br>
- (1,12) unqualified type in strict mode for: authors]<br>
<br>
What is the right way to do this?<br></blockquote><div><br>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.<br>
<br>-W<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Thanks.<br>
-Simon<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>