[rules-users] Is there a better way to write this rule?

Leonard93 leonardlindenau at hotmail.com
Wed Apr 23 07:17:51 EDT 2014


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.


More information about the rules-users mailing list