codeJack
codeJack

Reputation: 2503

Use Drools' declarative-model generated classes as main business object model

Can Drools' compile-generated classes be used as main business object model ?

Within a Drools application we pay huge mapping costs due to the fact that the different service interfaces are mapped into an intermediate JAVA model before being mapped into Drools' fact model to fire rules (and backwards).

I'd like to get rid of such extra abstraction layer to improve efficiency and I was thinking about using Drools' fact model directly as a business object model for any pre or post processing logic.

Eventually I'd like to extend Drools generated classes to add technical attributes which do not need to be part of the fact model but that would be convenient for the pre and post processing business.

Any drawbacks with this approach (assuming it works)?

Upvotes: 0

Views: 106

Answers (1)

ali köksal
ali köksal

Reputation: 1227

It will create a high coupling situation between your application and drools. I suggest you use separate classes for your application and drools model. If you name two set of classes and attributes the same, you can use reflection (eg beanutils) to copy values to-and-fro that should reduce your mapping costs.

Upvotes: 1

Related Questions