繁体   English   中英

如何使用 JAXB 序列化非原始数据?

[英]How to serialize non primitive data using JAXB?

我想使用 JAXB 序列化 object。 我的 class 定义如下所示:

@XmlRootElement
public class MyClass{
     <<How do I annotate this one?>>
     private xyz_type xyz;
     @XmlElement(name = "unique")
     private int unique;
} 
public class xyz_type extends abc_type{
    private qwe_tpe qwe;
    public static final ert_type ARRAY = ert_type.ARRAY; 
} 

提前感谢您的帮助!

您需要客户 XML 适配器来编组复杂数据类型。

请参阅本指南: https://www.baeldung.com/jaxb - 6. 复杂数据类型

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM