[rules-users] Globals and Boolean object

vdelbart delbart.v at mipih.fr
Tue Sep 18 10:31:08 EDT 2007


thanks,

 it's working. 


V.



Mark Proctor wrote:
> 
> 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.
>>
>>
>>   
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Globals-and-Boolean-object-tf4474442.html#a12758332
Sent from the drools - user mailing list archive at Nabble.com.





More information about the rules-users mailing list