It only works if you do it like this: rule "Discount Egypt" salience 0 when $T : TripRequest ( destination == "Egypt" ) $dest: DiscountResult() then $dest= (DiscountResult) $T.getResult(); $dest.setDiscount(5); end
Since getResult() returns an instance of the interface IResult, it needs to be cast to the proper type first. But this approach does not feel better than the previous notation. But thanks for the replies. -- View this message in context: http://drools.46999.n3.nabble.com/Is-there-a-better-way-to-write-this-rule-tp4029327p4029333.html Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users