<br> Interesting question. This is not supported right now, but I see no reason (besides being a really technical, not business related constraint) why we shouldn't support it.<br> Just for the sake of exploring the issue, I played a bit with it and realized this is probably a limitation in our QualifiedIdentifierRestriction. There are work arounds, but I don't see any advantage in them compared to the eval. For instance, something like this will work:<br>
<br>position : Position(option : instrument, $oc : option.class )<br>Class( name == "some.package.OptionInstrument" ) from $oc<br><br> Or, in case you actually assert an OptionInstrument class into the working memory:<br>
<br>$oc : Class( name == "some.package.OptionInstrument" )<br>position : Position(option : instrument, option.class == $oc )<br>
<br> So, for now, probably best to use the eval (as bellow), and if you may, open a feature request for use to properly support it in the future.<br><br>position : Position(option : instrument, eval( option instanceof OptionInstrument ) )<br>
<br> []s<br> Edson<br>
<br><br><br><div class="gmail_quote">2008/5/23 Barry Kaplan <<a href="mailto:groups1@memelet.com">groups1@memelet.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
I would like to match on the class of a field. I know I can use "eval(option<br>
instanceof OptionInstrument)", but my understanding is that the use of eval<br>
precludes indexing. What I want is something like the below, which does not<br>
work. Is some other mechanism other than putting type codes that are<br>
redundant with the class for this use case?<br>
<br>
thanks!<br>
<br>
----<br>
rule "Long Call/Put, Short Uncovered Call/Put"<br>
when<br>
position : Position(option : instrument, option.class ==<br>
OptionInstrument.class)<br>
then<br>
...<br>
end<br>
----<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://www.nabble.com/Matching-on-instanceof-without-eval--tp17425953p17425953.html" target="_blank">http://www.nabble.com/Matching-on-instanceof-without-eval--tp17425953p17425953.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<br>
<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>
</font></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>