JAXB - Annotations, Annotation for Classes: XmlType
2016-05-20 12:56
357 查看
This annotation adds information that would be available from a schema type, but isn't implied by a Java class declaration. The annotation has several attributes:
The attribute
The
The string array value defined by
Here is an example for
factoryClassand
factoryMethoddefine the class containing a no-argument method for creating an instance of this class as the equivalent of an empty XML element.
The attribute
nameprovides the XML schema name if you don't want to use the class name.
The
namespaceattribute provides the name of the target namespace.
The string array value defined by
propOrderestablishes an ordering of the sub-elements. (It's pretty obvious that there can't be a connection between the textual order of items in a class definition and the order its fields are returned by reflection methods.)
Here is an example for
XmlType, requesting that the elements
title,
itemsand
clustershould appear in the given order:
@XmlRootElement @XmlType( propOrder={ "title", "items", "cluster" } ) public class Document { ... }
相关文章推荐
- LeetCode 287
- 运维审计系统
- LeetCode 278
- LeetCode 274
- 各类编程软件安装配置流程
- 获取系统表和字段
- 手把手教程 Surface如何进行系统恢复?
- 坐标距离算法
- 网络流二十四题之十九 —— 负载平衡问题
- Android 史上最简单的实现Canvas drawText文字垂直居中
- Andriod开发环境搭建
- LeetCode 264
- 程序启动 - 类调用的方法
- 平日小问题(3):分数的求和问题
- [记忆向]工作中一些实用的Linux命令组合(持续)
- Discuz X3.2插件开发(一)
- RecyclerView学习(二)----高仿网易新闻栏目动画效果
- SPOJ_10628_Count_on_a_Tree_(主席树+Tarjan)
- LeetCode 206
- LeetCode 189