I have implemented builder design pattern and I have conditions on the abstract class and want to update the fact that extends the abstract class. Although the rule is fired but it doesn't update the fact why?
DRL
rule "Rule_1"
when
$a : AnotherClas.Builder()
$b : AnotherClas(definitionName = "test") from $a.build
then
$b.setUpdateFact("updated");
end
JAVA CLASS
public abstract class TestClass{
public final String definitionName;
protected TestClass(String definitionName) {
this.definitionName = definitionName;
}
}
ANOTHER JAVA CLASS
public class AnotherClass extends TestClass{
private String updateFact;
private TestClass(String reviewDefinitionName) {
super(reviewDefinitionName);
}
public void setUpdateFact(String updateFact) {
this.updateFact= updateFact;
}
public void getUpdateFact() {
return updateFact;
}
public static class Builder {
private String definitionName;
public TestClass build() {
return new TestClass(definitionName);
}
public Builder definitionName(String definitionName) {
this.definitionName = definitionName;
return this;
}
}
}
Is there anything I am missing? please help me with the correct way to implement this