I have a class called Client like this..
public class Client {
private Long id;
private String firstName;
private String lastName;
private Collection<String> emails = new Vector<String>();
/**
* @return Returns the emails.
*/
public Collection<String> getEmails() {
return emails;
}
/**
* @param emails The emails to set.
*/
public void setEmails(Collection<String> emails) {
this.emails = emails;
}
/**
* @param email The email to add.
*/
public void addEmail(String email) {
this.emails.add(email);
}
/** more methods... */
}
When I marshal a Client object I get something like
<client>
<first-name>a</first-name>
<last-name>b</last-name>
<emails>[EMAIL PROTECTED]</emails>
<emails>[EMAIL PROTECTED]</emails>
</client>
Although I'd prefer <email> instead of <emails> it's ok.. the problem is
when I want to unmarshall it.. it fails ("cannot instantiate
java.util.Collection") .. but it works if I write <email> .. like this:
<client>
<first-name>a</first-name>
<last-name>b</last-name>
<email>[EMAIL PROTECTED]</email>
<email>[EMAIL PROTECTED]</email>
</client>
The problem is that I want to work with the same XML when marshalling
and unmarshalling, and WITHOUT ANY XML MAPPING FILE.
So, how can I use the same XML for marshalling/unmarshalling collections
WITHOUT any XML mapping file?
Thanks,
Matias.
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------