Guys,
I have this Xml:
<hashedAddresses>
<personAddress index='1'>
<hashedAddress>asdfasdf</hashedAddress>
<hashedAddress>asdfasdf</hashedAddress>
<hashedAddress>asdfasdf</hashedAddress>
</personAddres>
<personAddress index='2'>
<hashedAddress>asdfasdf</hashedAddress>
<hashedAddress>asdfasdf</hashedAddress>
<hashedAddress>asdfasdf</hashedAddress>
</personAddres>
</hashedAddresses>
That I want to unmarshall in this class:
public class EmailHashEntry {
private int index;
private List<String> hashes;
public EmailHashEntry() {
}
public void setHashes(List<String> hashes) {
this.hashes = hashes;
}
public void setIndex(int index) {
this.index = index;
}
public List<String> getHashes() {
return hashes;
}
public int getIndex() {
return index;
}
}
Using this MAPPING:
<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "
http://castor.org/mapping.dtd">
<mapping>
<class name="com.linkedin.osc.model.EmailHashEntry" >
<map-to xml="hashedAddresses"/>
<field name="index" >
<bind-xml name="index" node="attribute" />
</field>
<field name="hashes">
<bind-xml name="hashAddress" location="personAddresses"
node="element" />
</field>
</class>
</mapping>
PROBLEM:
java.lang.IllegalArgumentException: list is not a valid
FieldMappingCollectionType
I adding "collection='arraylist'" to the mapping and got a NPE.
Thanks