[rules-users] comparisons on Java primitive wrapper class types

wasabifan bryan.rickman at kewill.com
Wed Mar 28 16:21:30 EDT 2007


class MyObject {
  private Integer used;
  private Integer notUsed;
  // public setters/getters...
}

rule "1"
  when
    MyObject(used == 1)
  then
    // do something
end

rule "2"
  when
    UnrelatedObject(data == 5)
    MyObject(notUsed == 2)
  then
    // do something else
end

Basically, I am trying to create JUnit test cases to test each of the rules
functionality.  So I would instantiate and object, set the required data to
fire a rule, assert the object and fire all rules.  So when setting
MyObject.used = 1, then asserting that fact...it appears that rule 2 would
complain that notUsed is null (even though I do not have an asserted fact
where UnrelatedObject(data == 5).

Does this make sense?  I know this is sort of pseudo code thrown together
quickly, but I think that explains what I was experiencing.  If not, I can
go back to get some of the actual code, but that would be much longer.

Thanks,
Bryan


Edson Tirelli-3 wrote:
> 
>     Can you please provide one example for us to understand better the
> case?
> 

-- 
View this message in context: http://www.nabble.com/comparisons-on-Java-primitive-wrapper-class-types-tf3481733.html#a9721787
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list