O'Reilly logo

Drools JBoss Rules 5.X Developer's Guide by Michal Bali

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Creating Custom Operators

We've already seen various operators that can be used within rule conditions. These include == and !=; relational operators such as >, <, and >= ; temporal operators such as after, during, and finishes; or others such as matches, which does regular expression matching. In this section we'll define our own custom operator.

The == operators uses the Object.equals or hashCode methods for comparing objects. However, sometimes we need to test if two objects are actually referring to the same instance. This is slightly faster than Object.equals or hashCode comparison (only slightly faster, because the hash code is calculated once for object and then it is cached).

Imagine that we have a rule, which matches on an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required