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:

  • factoryClass and factoryMethod define the class containing a no-argument method for creating an instance of this class as the equivalent of an empty XML element.
  • The attribute name provides the XML schema name if you don't want to use the class name.
  • The namespace attribute provides the name of the target namespace.
  • The string array value defined by propOrder establishes 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 titleitems and cluster should appear in the given order:

@XmlRootElement
@XmlType( propOrder={ "title", "items", "cluster" } )
public class Document {
...
}

JAXB - Annotations, Annotation for Classes: XmlType的更多相关文章

  1. JAXB - Annotations, The Annotation XmlElement

    The basic annotation for a field that's intended to be an element is XmlElement. It permits you to d ...

  2. JAXB - Annotations, Controlling Element Selection: XmlAccessorType, XmlTransient

    If JAXB binds a class to XML, then, by default, all public members will be bound, i.e., public gette ...

  3. JAXB - Annotations, Top-level Elements: XmlRootElement

    A class that describes an XML element that is to be a top-level element, i.e., one that can function ...

  4. JAXB - Annotations, Type Adapters: XmlJavaTypeAdapter

    For some Java container types JAXB has no built-in mapping to an XML structure. Also, you may want t ...

  5. JAXB - Annotations, Type Mapping: XmlSchemaType

    The annotation XmlSchemaType defines a mapping between an arbitrary Java type and a simple schema bu ...

  6. JAXB - Annotations, Annotations for the Schema: XmlSchema

    This annotation can only be used with a package. It defines parameters that are derived from the xsd ...

  7. JAXB - Annotations, The Object Factory: XmlRegistry, XmlElementDecl

    To be able to create objects from XML elements, the unmarshaller must have an object factory with me ...

  8. JAXB - Annotations, Class Fields as Attributes: XmlAttribute

    Provided that XML lets you represent a data item as a single value, there is no cut-and-dried rule f ...

  9. JAXB - Annotations, Annotations for Enums: XmlEnum, XmlEnumValue

    An enum type is annotated with XmlEnum. It has an optional element value of type java.lang.Class whi ...

随机推荐

  1. MapReduce 支持的部分数据挖掘算法

    MapReduce 支持的部分数据挖掘算法 MapReduce 能够解决的问题有一个共同特点:任务可以被分解为多个子问题,且这些子问题相对独立,彼此之间不会有牵制,待并行处理完这些子问题后,任务便被解 ...

  2. Java 开发@ JDBC链接SQLServer2012

    下面请一字一句地看,一遍就设置成功,比你设置几十遍失败,费时会少得多. 首先,在连接数据库之前必须保证SQL Server 2012是采用SQL Server身份验证方式而不是windows身份验证方 ...

  3. Java异常的面试问题及答案-Part 1

    本文由 ImportNew - 韩远青 翻译自 Journaldev. Java提供了一个健壮的.面向对象的方法来处理出现异常,称为Java异常处理.我以前写过一篇长文章来介绍Java异常处理,今天我 ...

  4. A Tour of Go Function values

    Functions are values too. 在函数式语言中中函数都是变量,比如在javascript中 package main import ( "fmt" " ...

  5. 第十三章、学习 Shell Scripts

    什么是 Shell scripts shell script (程序化脚本) :shell script 是针对 shell 所写的『脚本!』 shell script 是利用 shell 的功能所写 ...

  6. [iOS基础控件 - 5.2] 查看大图、缩放图片代码(UIScrollView制作)

    原图: 900 x 1305      拖曳滚动:   缩放:           主要代码: // // ViewController.m // ImageZoom // // Created by ...

  7. 射频识别技术漫谈(15)——Mifare1的安全性及7字节序列号M1卡【worlsing笔记】

    Mifare1的安全性主要指卡中数据的安全性,要求卡中的数据不能被非法修改或窃听.数据的安全性主要使用加密技术来保证,加密技术有两个关键因素:加密算法和密钥.现代加密技术的一大特点是加密算法公开,如果 ...

  8. sql语句常见错误

    1.两张表关联用的三种连接:  left join .right join .inner join区别 (备注:两个表链接肯定是根据两个表(如A B)中的两个字段值(如A.bId和B.id),相等就行 ...

  9. mysql服务的启动和停止 net stop mysql net start mysql

    第一招.mysql服务的启动和停止 net stop mysql net start mysql 第二招.登陆mysql 语法如下: mysql -u用户名-p用户密码 键入命令mysql -uroo ...

  10. Delphi静态加载DLL和动态加载DLL示例

    下面以Delphi调用触摸屏动态库xtkutility.dll为例子,说明如何静态加载DLL和动态加载DLL. 直接上代码. 1.静态加载示例 unit Unit1; interface uses W ...