I have an SDO-like object that I need to parse with the help of digester rules. Object can have a list that stores same types as object itself e.g.
class SdoLike{
private List<SdoLike> listValue;
public addListValueItem(SdoLike sdoLike){
this.listValue.add(sdoLike);
}
}
How to define digester rules for that in xml?
<pattern value="ListValue">
<object-create-rule classname="SdoLike"/>
<!--.......... -->
开发者_JAVA百科 <set-next-rule methodname="addListValueItem"/>
</pattern>
thanks.
So.. after some time
I placed a rule definition of SdoLike class into a separate file and
<pattern value="*/ListValue">
<object-create-rule classname="tra.ta.ta.SdoLike" />
<extended-include path="META-INF/digester/SdoLike.xml" />
<set-next-rule methodname="addListValueItem" />
</pattern>
this pattern must not be nested into other patterns.
精彩评论