What is sens type element in @XmlElement annotation?
sth like this:
XmlElement(name = "userId", type = Long.class)
private Long id;
It is not used during XML generation.
The type
property on @XmlElement
is used in the following scenarios:
List
instead of List<String>
you would use type=String.class
. @XmlElement
is used with @XmlElements
to model a choice the type
property maps the element to a class. XmlAdapter
can't be applied to a datatype. Using type to bump it up to the correspond object type fixes this problem. xsi:type
attribute to be marshalled you can specify type=Object.class
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.