<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 17/01/2012 21:00, Edson Tirelli wrote:
<blockquote
cite="mid:CAD7AJnd6zxkQcN2+QkiEMv=1ttWVFfxAX-TXXcbESxzuh+qb3w@mail.gmail.com"
type="cite">
<div><br>
</div>
Nicely done sir! :)
<div><br>
</div>
<div> My only comments are very minor... </div>
<div><br>
</div>
<div>* I think we should keep the property names consistent
between the java and the declare element, so I suggest you use
uppercase for both (@PropSpecific). <br>
</div>
</blockquote>
it's kept with how we have the other annotations on type
declarations, all of which allow lower case at the moment.<br>
@role<br>
@format<br>
@position<br>
<blockquote
cite="mid:CAD7AJnd6zxkQcN2+QkiEMv=1ttWVFfxAX-TXXcbESxzuh+qb3w@mail.gmail.com"
type="cite">
<div>* I think @onChange is more meaningful to me than @watch, but
that is just my opinion.</div>
<div><br>
</div>
</blockquote>
we can have a wider vote. I was bit uncomfortable with onChange,
because it could mean other things. Watch was shorter and I think
more accurate. "Just watch these properties". onChange sounds like
we should be attaching some callback, for an event that has
happened.<br>
<br>
<blockquote
cite="mid:CAD7AJnd6zxkQcN2+QkiEMv=1ttWVFfxAX-TXXcbESxzuh+qb3w@mail.gmail.com"
type="cite">
<div> On the pattern annotation, how is the EBNF now?</div>
<div><br>
</div>
<div>lhsPattern := QUESTION? qualifiedIdentifier LEFT_PAREN
positionalConstraints? constraints? RIGHT_PAREN
annotation* (OVER patternFilter)? (FROM patternSource)?</div>
<div>
<div><br>
</div>
<div> Thanks,</div>
<div> Edson</div>
<br>
<div class="gmail_quote">On Tue, Jan 17, 2012 at 2:20 PM, Mario
Fusco <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:mario.fusco@gmail.com">mario.fusco@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
just a quick recap of what I did until now to check if we
are all on the same page and also agree with the naming
convention I used.<br>
<br>
The property specific feature is off by default in order to
make the behavior of the rule engine backward compatible
with the former releases. If you want to activate it on a
specific bean you have to annotate it with @propSpecific.
This annotation works both on drl type declarations:<br>
<br>
declare Person<br>
@propSpecific<br>
firstName : String<br>
lastName : String<br>
end<br>
<br>
and on Java classes:<br>
<br>
@PropSpecific<br>
public static class Person {<br>
private String firstName;<br>
private String lastName;<br>
}<br>
<br>
Moreover on Java classes you can also annotate any method to
say that its invocation actually modifies other properties.
For instance in the former Person class you could have a
method like:<br>
<br>
@Modifies( "firstName, lastName" )<br>
public void setName(String name) {<br>
String[] names = name.split("\\s");<br>
this.firstName = names[0];<br>
this.lastName = names[1];<br>
}<br>
<br>
That means that if a rule has a RHS like the following:<br>
<br>
modify($person) { setName("Mario Fusco") }<br>
<br>
it will correctly recognize that both the firstName and
lastName have been modified and act accordingly. Of course
the @Modifies annotation on a method has no effect if the
declaring class isn't annotated with @PropSpecific. <br>
<br>
The third annotation I have introduced is on patterns and
allows you to modify the inferred set of properties
"listened" by it. So, for example, you can annotate a
pattern in the LHS of a rule like:<br>
<br>
Person( firstName == $expectedFirstName ) @watch( lastName )
// --> listens for changes on both firstName (inferred)
and lastName<br>
Person( firstName == $expectedFirstName ) @watch( * ) //
--> listens for all the properties of the Person bean<br>
Person( firstName == $expectedFirstName ) @watch( lastName,
!firstName ) // --> listens for changes on lastName and
explicitly exclude firstName<br>
Person( firstName == $expectedFirstName ) @watch( *, !age )
// --> listens for changes on all the properties except
the age one<br>
<br>
Once again this annotation has no effect if the
corresponding pattern's type hasn't been annotated with
@PropSpecific.<br>
<br>
I've almost finished with the development of this feature
(at the moment I am missing the compile-time check of the
properties named in the @watch annotation together with some
more exhaustive tests), so if you think that I misunderstood
something or there is room for any improvement (or you just
don't like the annotation's names I chose) please let me
know as soon as possible.<span class="HOEnZb"><font
color="#888888"><br>
<br>
Mario<br>
</font></span><br>
_______________________________________________<br>
rules-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-dev"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
JBoss by Red Hat @ <a moz-do-not-send="true"
href="http://www.jboss.com">www.jboss.com</a><br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>