Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

Traits in Drools - Rules with dynamic attributes in the object

Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to write a dynamic rule engine through Drools. Means, if a new property/attribute is added to the object which will be used for evaluation, i should not need to code a new field in that DTO, and redeploy that code.

Found something trait close to that. I find 2 issues in it. Can somebody help?

1. knowledgeSession.fireAllRules() returns the number of matches to the provided object. Here it returns more than the number of rules documented in the drl.
2. whatever i do my insert (new PolypathSystem()) does not work. It keeps saying org/drools/core/factmodel/traits/test/ (9:566) : Cannot instantiate the type PolypathSystem

Please help.
my java code looks like below. As its a test code and so the content of the drl file is hardcoded here itself

Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
create, convert, edit or print DOC and DOCX in Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!