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 Goodwin <mg...@metalexis.com> on 2005/01/13 18:01:41 UTC
[betwixt] Collection property question
I have xml I need to map to my bean. It is very similar to the
CustomerBean example, except I am using Collection instead of and array
of objects (i.e. Order[]). Here is a sample of the xml, followed by my
class, followed by my .betwixt file. The problem I am having is the
List is always null. How do you map objects in the .betwixt file if the
collection has no surrounding element tag (i.e.
<orders></order></order></orders>)?
Example xml:
<AgentStatementVO>
<StatementDate>2004/10/08</StatementDate>
<AgentInfoVO>...</AgentInfoVO>
<AgentStatementLineVO>...</AgentStatementLineVO>
<AgentStatementLineVO>...</AgentStatementLineVO>
<AgentEarningsVO>...</AgentEarningsVO>
</AgentStatementVO>
Class:
public class AgentStatement implements java.io.Serializable {
private Date statementDate;
private AgentInfo agentInfo;
private Collection agentStatementDetails = new java.util.ArrayList();
private AgentEarning agentEarning;
/* .. snip non-relevant getters/setters */
public Collection getAgentStatementDetails() {
return agentStatementDetails;
}
public void setAgentStatementDetails(Collection agentStatementDetails) {
this.agentStatementDetails = agentStatementDetails;
}
public void addAgentStatementDetail(AgentStatementDetail
agentStatementDetail) {
this.agentStatementDetails.add(agentStatementDetail);
}
}
Betwixt file:
<?xml version='1.0' ?>
<info>
<element name='AgentStatementVO'>
<element name='StatementDate' property='statementDate'/>
<element name='AgentInfoVO' property='agentInfo'/>
<element name='AgentStatementLineVO'
property='agentStatementDetails'
class='com.equitrust.commissionloader.beans.AgentStatementDetail'/>
<element name='AgentEarningsVO' property='agentEarning'/>
</element>
</info>
Everything except the agentStatementDetails are populated correctly.
Thanks,
Matt
--
Matt Goodwin
mgoodwin@metalexis.com
(515)708-0114
Metalexis
"Transcending the Ordinary"
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org