Drools :: Declaring New Types

To declare a new type, all you need to do is use the keyword declare, followed by the list of fields, and the keyword end. A new fact must have a list of fields, otherwise the engine will look for an existing fact class in the classpath and raise an error if not found.

Declaring a new fact type: Counter:

Each attribute of declared type has a type that can be any valid Java type, including any other class created by the user or even other fact types previously declared:

Using the declared type




Leave a Reply