[rules-users] The constructor is not visible

Ming Fang mingfang at mac.com
Thu Jan 17 15:54:15 EST 2013


Constructor needs to be public scope. 

Sent from my iPad

On Jan 17, 2013, at 3:45 PM, suddeb <sudipta.deb at gmail.com> wrote:

> Hi,
> I am trying to create a rule:
> 
> //list any import classes here.
> *import com.sudipta.sample.Student;
> import com.sudipta.sample.PassType;
> rule "If Student's age is less than 19"
> 
>    when
>        $student : Student(age<19)
>    then
>        System.out.println("Child Pass for "+$student.getName());
>        System.out.println("Creating PassType Object..");
>        insert(new PassType($student,"Child"));
> 
> end*
> 
> I am getting the error:
> The constructor PassType(String) is not visible
> 
> Whereas in the PassType class, the constructor is defined like:
> *public class PassType {
> 
>    private Student student;
>    private String type;
>    
>    PassType(Student student, String type){
>        this.student = student;
>        this.type = type;
>    }
> ......
> }*
> 
> Can anyone please help me why this error is coming? Thanks.
> 
> Regards,
> Sudipta
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/The-constructor-is-not-visible-tp4021627.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


More information about the rules-users mailing list