Reputation: 275
I am trying to call a method and pass a String as an argument to that method when processing a particular tag for XML-to-Object transformation using Digester:
<pattern value="abc/xyz">
<object-create-rule classname="com.test.XYZ"/>
<call-method-rule methodname="setTypeName" paramcount="1" paramtypes="java.lang.String"/>
<call-param-rule paramnumber="0"/>
</pattern>
This sets the typeName in XYZ to empty string, but I want to set it to some other fixed string (e.g. "test"). How do I specify this fixed string in call-method-rule or call-param-rule?
Upvotes: 1
Views: 980
Reputation: 1452
There is a object-param-rule
for this
Try
<pattern value="abc/xyz">
<object-create-rule classname="com.test.XYZ"/>
<call-method-rule methodname="setTypeName" paramcount="1" paramtypes="java.lang.String"/>
<object-param-rule paramnumber="0" type="java.lang.String" value="test" />
</pattern>
Upvotes: 1