Jay
Jay

Reputation: 27492

Including functions in Drools declared types

Is there a way to add member functions to a Drools declared type? That is, I'd like to say something like:

declare Foo
  bar : int
  plugh : String
  function String greeting()
  {
    return "Hello "+plugh+"!";
  }
end

That doesn't work (or I wouldn't be writing this post), but do I just have the syntax wrong, or is there no way to do that in Drools?

Upvotes: 1

Views: 1326

Answers (1)

Perception
Perception

Reputation: 80633

You cannot include functions in a Drools declared type (above and beyond what it generates in the class to support Bean property types). If you find you need functions in a declared type you should probably create them in your regular Java then import them into your rule file.

Upvotes: 2

Related Questions