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

Edson Tirelli tirelli at post.com
Thu Mar 29 11:09:28 EDT 2007


   Yes, this should not be raising errors.

   Michael,

   What was the conclusion of the discussion about null handling?

   Thanks,
    Edson


2007/3/28, wasabifan <bryan.rickman at kewill.com>:
>
>
> 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.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3124-6000
  Mobile: +55 11 9218-4151
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070329/648f3ac1/attachment.html 


More information about the rules-users mailing list