Как обернуть не список элементов в Jaxb - PullRequest
0 голосов
/ 13 января 2020

У меня есть эта модель

@Getter
@Setter
@ToString
@XmlRootElement(name="activite-validee")
@XmlAccessorType(XmlAccessType.FIELD)
public class ActiviteValide implements Serializable{

  private static final long serialVersionUID = -5207914452736289060L;
  @XmlElement(name="code_tournee")
  private String codeTournee;
  @JsonDeserialize(using = MomentLocalDateDeserializer.class) @JsonSerialize(
      using = LocalDateSerializer.class) 
  @XmlElement(name="date")
  private LocalDate dateTournee;
  @XmlElement(name="poste_comptable")
  private String posteComptable;
  @JsonDeserialize(using = TypeSimpleToTypeTourneeDeserializer.class) private TypeTournee typeTournee;
  private String identifiantC11;
  private String moyenTournee;
  private String identifiantSousTraitant;
  private String nomSousTraitant;
  private String planTournee;
  @JsonDeserialize(using = TypeSimpleToTypeSaisieActivite.class) private TypeSaisieActivite typeSaisieActivite;
  @XmlElement(name="activite")
  @XmlElementWrapper(name="activites")
  private List<Activite> listActivite;
}

Мне нравится получать xml от этой модели следующим образом:

<activite-validee version="1.0">
    <tournee>
        <poste_comptable>75199</poste_comptable>
        <date>2019-08-27</date>
        <code_tournee>99R53</code_tournee>
        <type_tournee>C</type_tournee>
        <identifiant_c11>99R5327082019000001</identifiant_c11>
        <moyen_tournee>ST</moyen_tournee> 
        <identifiant_sous_traitant>84000002</identifiant_sous_traitant>
        <nom_sous_traitant>JBBROCQ TRANSPORT AND CO</nom_sous_traitant> 
        <plan_tournee> </plan_tournee>
    </tournee>
    <activites>
        <activite>
            <type_activite>COL</type_activite>
            <type_point_facture>STD</type_point_facture>

Как я могу использовать Jaxb обернуть первые элементы модель (не список) в элемент tournee (@XmlElementWrapper не работает)?
благодарности

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...