[rules-users] Globals and Boolean object
Mark Proctor
mproctor at codehaus.org
Tue Sep 18 10:05:58 EDT 2007
java is pass by reference, so all you are doing is assigning the local
test pointer to point to something else; which ofcourse won't be
reflected in the global resolvers
drools.getWorkingMemory.setGlobal("test", test");
Mark
vdelbart wrote:
> Hi,
>
> My rule is :
> #created on: 29 août 2007
> package example
>
> #list any import classes here.
> global Boolean test
>
> rule "Your Third Rule"
> #include attributes such as "salience" here...
> when
> then
> #actions
> test = true;
> System.out.println("OK-" + test);
> end
>
> In my java codes, I have :
>
> session.setGlobal("test", new Boolean(false));
> System.out.println("global " + session.getGlobal("test"));
> session.fireAllRules();
> System.out.println("global " + session.getGlobal("test"));
>
> I expect this :
> global false
> OK-true
> global true
>
> but I have :
> global false
> OK-true
> global false
>
> Anybody have a solution to manipulate Boolean object in globals ?
>
>
> thanks,
>
> V.
>
>
>
More information about the rules-users
mailing list