[rules-users] Passing List in declaredTypes object constructor

lukes mail2lokesh at gmail.com
Wed Feb 12 10:01:17 EST 2014


Hi all,

  I am new to drools and trying to write some basic rules. My rules works
fine as long as i don't have a list in the declaredTypes, but as i declare
one of the member as List, it throws errors in runTime. I am assuming the
List can be passed as [] but looks like i am wrong. Below is my drools file,
should be great if someone can point me on how to create the list.

                package com.sample
                import java.util.HashMap;
                import java.util.Map;
                import java.util.ArrayList;

                declare Customer
                @propertyReactive
                name : String
                seniority : int
                discount : double
                list : java.util.ArrayList
                end
                 rule \"kickoff\"
                salience 100
                 when
                 then
                 Customer c = new Customer( "Bob", 10, 0.0d, ["asa"]);  //
Error is thrown here at runTime.
                 insert(c);
                 insert( new Integer(1000) );
                 System.out.println(\"new Customer created\");
                 end

Thanks in advance. 



--
View this message in context: http://drools.46999.n3.nabble.com/Passing-List-in-declaredTypes-object-constructor-tp4028091.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list