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.
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:
position : Position(option : instrument, $oc : option.class )
Class( name == "some.package.OptionInstrument" ) from $oc
Or, in case you actually assert an OptionInstrument class into the
working memory:
$oc : Class( name == "some.package.OptionInstrument" )
position : Position(option : instrument, option.class == $oc )
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.
position : Position(option : instrument, eval( option instanceof
OptionInstrument ) )
[]s
Edson
2008/5/23 Barry Kaplan <groups1(a)memelet.com>:
I would like to match on the class of a field. I know I can use
"eval(option
instanceof OptionInstrument)", but my understanding is that the use of eval
precludes indexing. What I want is something like the below, which does not
work. Is some other mechanism other than putting type codes that are
redundant with the class for this use case?
thanks!
----
rule "Long Call/Put, Short Uncovered Call/Put"
when
position : Position(option : instrument, option.class ==
OptionInstrument.class)
then
...
end
----
--
View this message in context:
http://www.nabble.com/Matching-on-instanceof-without-eval--tp17425953p174...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com