[rules-users] [rules-user] problem with private members (no getters)

Michael Anstis michael.anstis at gmail.com
Fri Feb 10 05:55:39 EST 2012


How would you use a class with private members and no getters in any other
Java application?

If you want the members of the class to influence rules you're going to
have to expose them somehow.

Even if you set the global at the same time as you set the class's member
you are effectively trying to use globals as a substitute for objects of
your class.

If you really, really can't expose members of the class then perhaps you
should:-

   - Question why you need to use it in a rule in the first place, or


   - Use a Declared Type


On 10 February 2012 10:43, ehmkey <ehmkey at gmail.com> wrote:

> Hey all,
>
> i have a class with private members and no getters. I realized my rules
> with
> the 'global' keyword. I read that global isnt good for every case, does a a
> better solution exist?
>
> public class example {
>  private int number;
>  ..
>  ..
> }
>
> *.drl:
> package example;
>
> global int number;
>
> rule ....
>
> Thank you!
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-user-problem-with-private-members-no-getters-tp3732106p3732106.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120210/0fecdd18/attachment.html 


More information about the rules-users mailing list