You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Matt Campbell <ma...@gmail.com> on 2006/11/02 15:56:09 UTC
[Commons-Digester] Mapping an ArrayList
I have the following simple xml file.
<security>
<security-sections>
<section>
<name>issueDetail</name>
<role>manager</role>
<role>user</role>
</section>
<section>
<name>person</name>
<role>user</role>
</section>
</security-sections>
</security>
The Digester rules
<?xml version="1.0" encoding="UTF-8"?>
<digester-rules>
<pattern value="security/security-sections">
<object-create-rule classname="java.util.ArrayList"/>
<set-properties-rule/>
<pattern value="section">
<object-create-rule classname="
mil.stes.model.security.SecuritySection"/>
<bean-property-setter-rule pattern="name"/>
<!-- NEED TO MAP ROLES ARRAYLIST HERE -->
<set-next-rule methodname="add" paramtype="java.lang.Object"/>
</pattern>
</pattern>
</digester-rules>
I've tried multiple times to map the role elements to an arraylist but it
never works. There is no documentation on how to map this on the website so
im asking here.
How would I map the role elements to an arraylist named roles?