[rules-users] Class Casting in a Collection data

VinuJay vinod.jayendra at wipro.com
Mon Jun 15 05:51:33 EDT 2009


Hi my fact object looks like this,

class ProcessRequest {
 
  Long requestId;

  String processType;

  String assigneeUsers;

  HashTable<String,Object> businessData;

  //Getters and Setters

} 

My businessdata can be of type Integer, String, Boolean, hence i have used
generic Object for the business data value.

But if i use any mathematical operator in the rules (.drl) file like, 
rule "Assign"
when
p: ProcessRequest(processType == "LoanFlowPlus" &&
businessData['LOANAMOUNT'] < 5000)
then	
	p.setAssigneeUsers("jcooper");
end


i get an error 
Exception in thread "main" org.drools.RuntimeDroolsException: Exception
executing predicate eval( businessData['LOANAMOUNT'] < 5000 )
Caused by: java.lang.ClassCastException: java.lang.Integer


Shouldn't the drools API handle this class cast conversion internally ..? or
how to specify the class casting in rules file 





-- 
View this message in context: http://www.nabble.com/Class-Casting-in-a-Collection-data-tp24031803p24031803.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list