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. Bzoj4556: [Tjoi2016&Heoi2016]字符串 后缀数组

    4556: [Tjoi2016&Heoi2016]字符串 Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 169  Solved: 87[Sub ...

  2. 【原创】lua的module的一些点

    lua的module好像是5.1开始有的 在xx.lua的开头写上 module('my_module') 这行等价于如下几行 local name = 'my_module' local M = { ...

  3. dataStructure@ Check whether a given graph is Bipartite or not

    Check whether a given graph is Bipartite or not A Bipartite Graph is a graph whose vertices can be d ...

  4. HDU-4648 Magic Pen 6 简单题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4648 求遍前缀和,然后扫描标记下就可以了... //STATUS:C++_AC_453MS_1792K ...

  5. Linux江湖01:玩转Linux系统的方法论 (转载)

    http://www.blogjava.net/youxia/archive/2015/01/08/linux001.html 2014年上半年,我是在写RCP系列.然后,由于要准备研究生毕业论文和答 ...

  6. 44 个 JavaScript 变态题解析

    当初笔者做这套题的时候不仅怀疑智商, 连人生都开始怀疑了…. 不过, 对于基础知识的理解是深入编程的前提. 让我们一起来看看这些变态题到底变态不变态吧! 第1题 ["1", &qu ...

  7. 设置IE浏览器代理上网

    在局域网中,服务器可以直接通过IE网上冲浪,而工作站要想通过IE上网,如果是在服务器使用代理软件的情况下,其IE需要设置代理. 步骤一:启动IE浏览器,选择"工具",再" ...

  8. lazyload 图片延迟加载

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. 60款开源云应用【Part 2】(60 Open Source Apps You Can Use in the Cloud)

    60款开源云应用[Part 2](60 Open Source Apps You Can Use in the Cloud) 本篇翻译自http://www.datamation.com/open-s ...

  10. 【M13】以by reference 方式捕捉exceptions

    1.catch语句的参数有三种方式:by pointer,by value,by reference. 2.首先考虑,by pointer.这意味着抛出端必须抛出一个对象的地址.那么问题来了: 如果这 ...