[rules-users] Call class method from LHS of a rule

orchid maya.pollack at gmail.com
Mon Jan 4 06:49:07 EST 2010


Hi All,

I'm trying to call a class method from the LHS of a rule in the following
way:

public class Cheese{
  private string type;
  //setters and getters
  public boolean existsInShop(String shop){
    ...
    return true;
  }
}

I would like to call the method "existsInShop" from a rule:

Rule "Rule1"
  when
    $c:Cheese(type == "chedar", existsInShop "shopName")
  then
    System.out.println("Rule1 is fired");
end

I get the compilation error: "no viable alternative at input "shopName" in
rule "Rule1" in pattern document". How can I call the method from the rule?

Thanks in advance.



-- 
View this message in context: http://n3.nabble.com/Call-class-method-from-LHS-of-a-rule-tp108383p108383.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list