0
votes

I have seen a few Drools examples, both in the documentation and here on SO, that use this. The couple of times I have tried I have received errors. Is there any documentation anywhere that defines what can and cannot be done with this (and when it can be done)?

Thanks in advance,

1

1 Answers

1
votes

Think of this as just another field of a fact (or object), but in this case referring to the object as - the object.

As to the where (and when): It's exactly the same as this in Java, and so it must be in the context of a fact (or object). So, for instance:

$one: Foo() 
Foo( this != $one )

This guarantees the match of two different Foo objects.