|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: REQUIRED | OPTIONAL | 详细信息: ELEMENT |
javax.xml.bind.annotation Annotation Type XmlElementWrapper
Generates a wrapper element around XML representation. This is primarily intended to be used to produce a wrapper XML element around collections. The annotation therefore supports two forms of serialization shown below.
//Example: code fragment int[] names; // XML Serialization Form 1 (Unwrapped collection) <names> ... </names> <names> ... </names> // XML Serialization Form 2 ( Wrapped collection ) <wrapperElement> <names> value-of-item </names> <names> value-of-item </names> .... </wrapperElement>
The two serialized XML forms allow a null collection to be represented either by absence or presence of an element with a nillable attribute.
Usage
The @XmlElementWrapper annotation can be used with the following program elements:
- JavaBean property
- non static, non transient field
The usage is subject to the following constraints:
- The property must be a collection property
- This annotation can be used with the following annotations:
XmlElement
,XmlElements
,XmlElementRef
,XmlElementRefs
,XmlJavaTypeAdapter
.
See "Package Specification" in javax.xml.bind.package javadoc for additional common information.
- 从以下版本开始:
- JAXB2.0
- 作者:
- Kohsuke Kawaguchi, Sun Microsystems, Inc.
- Sekhar Vajjhala, Sun Microsystems, Inc.
- 另请参见:
XmlElement
,XmlElements
,XmlElementRef
,XmlElementRefs
Optional Element Summary | |
---|---|
String |
name
Name of the XML wrapper element. |
String |
namespace
XML target namespace of the XML wrapper element. |
boolean |
nillable
If true, the absence of the collection is represented by using xsi:nil='true'. |
name
public abstract String name
- Name of the XML wrapper element. By default, the XML wrapper
element name is derived from the JavaBean property name.
- 默认值:
- "##default"
namespace
public abstract String namespace
- XML target namespace of the XML wrapper element.
If the value is "##default", then the namespace is determined as follows:
-
If the enclosing package has
XmlSchema
annotation, and itselementFormDefault
isQUALIFIED
, then the namespace of the enclosing class. - Otherwise "" (which produces unqualified element in the default namespace.
-
If the enclosing package has
- 默认值:
- "##default"
nillable
public abstract boolean nillable
- If true, the absence of the collection is represented by
using xsi:nil='true'. Otherwise, it is represented by
the absence of the element.
- 默认值:
- false
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: REQUIRED | OPTIONAL | 详细信息: ELEMENT |
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.