Я новичок в Java и jaxb, поэтому я уверен, что проблема здесь очевидна.
Я сортирую объект, который выглядит следующим образом:
public class Annotation {
private RecipientCollection recipients;
@XmlElement
public RecipientCollection getRecipients() {
return recipients;
}
}
@XmlRootElement( name="Recipient" )
public class RecipientCollection extends ArrayList<Recipient> {
@XmlElement(name="Recipient")
private RecipientCollection recipients = this;
}
@XmlElement( name="Recipient" )
public class Recipient {
private String value;
private String name;
@XmlElement( name="Recipient" )
public String getValue() {
return value;
}
}
Мне нужен XML, который выглядит следующим образом:
<Annotation>
<recipients>
<recipient>
<RecipientName>test</RecipientName>
<Recipient>test</Recipient>
</recipient>
<recipient>
<RecipientName>test</RecipientName>
<Recipient>test</Recipient>
</recipient>
</recipients>
Но я получаю XML, который выглядит так:
<Annotation>
<DeletableBy>Administrator,Recipient</DeletableBy>
<recipients>
<RecipientName>test</RecipientName>
<Recipient>test</Recipient>
</recipients>
<recipients>
<RecipientName>test</RecipientName>
<Recipient>test</Recipient>
</recipients>
Все выглядело хорошо в случае с одним получателем, поэтому (я думаю) именно поэтому он был реализован таким образом. Любая помощь? Некоторое время я настраивал привязки, но ничего не работает, как я догадываюсь.