[rules-users] Class Casting in a Collection data

Edson Tirelli tirelli at post.com
Mon Jun 15 08:15:00 EDT 2009


   What versions of Drools and MVEL are you using?

   []s
   Edson

2009/6/15 VinuJay <vinod.jayendra at wipro.com>

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



-- 
 Edson Tirelli
 JBoss Drools Core Development
 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/20090615/d1c2f517/attachment.html 


More information about the rules-users mailing list