Newbie question on drools. I am trying to access the following java class in the rules file.
Class A{
private String foo;
private SomeClass B;
//getter setter for foo and b
}
Class B{
private String bar;
private Integer value;
//getter setter for bar and value
}
In the rule file I would like to access the member bar
.
So far this is what I have:-
package demo;
import my.test.A;
import my.test.B;
rule "Rule1"
when
$varB : A.B(bar.equals("hello"))
then
$varB.setValue(1);
update($varB);
end
For the above rule I get this error - "BuildError: Unable to resolve ObjectType A.B"
. I also tried using A.getB()
and that did not help either. Any idea what it should be? I am using eclipse drools plugin if that matters.
I have looked at the jboss rules docs but they do not cover the syntax stuff that well. Does anyone know of links where I can look up drools sy开发者_Go百科ntax and how tos like above?
This is probably better:
A(b.bar == "hello", $varB : b)
In DRL, ==
means equals, not same.
With $varB : b
you do something like B varB = a.getB();
try this way:
$varB : A(B.bar.equals("hello"))
精彩评论