我有这种格式的规则:
Condition -> Condition OPERATOR Condition | Condition
Condition -> attribute OPERATOR
value OPERATOR -> EQUALS | STARTS WITH | ENDS WITH | AND | OR | NOT EQUALS | CONTAINS
我需要为给定的规则创建一个 JAVA POJO(setters/getters)。我该怎么做?
是否应该创建任何外部解析器工具。我能够为 OPERATOR 部分创建:
//POJO CLASS
Class Condtion{
private String attr;
private String op;
private String value;
public String getAttr(){
this.attr=attr;
}
public String getOp(){
this.op=op;
}
public String getValue(){
this.value=value;
}
//setters for above three
}
如何为规则创建 POJO Condition->Condition OPERATOR Condition | Condition
?