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. Python3基础 reverse 将列表倒序排列

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...

  2. UISearchDisplayController隐藏navigationBar需注意

    不能调用self.navigationController.navigationBar.hidden = YES: 调用此代码的话,你隐藏了navigationBar搜索展示控制器就拿不到导航条:就会 ...

  3. C# 总结

    转自原文 C# 总结 1.类型是隐式内部的.(类) 2.类型成员是隐式私有的.(方法) 3.常量定义:const 是隐式static的,必须在定义时设置初始值. 4.只读字段:readonly 可以在 ...

  4. android NDK 笔记

    *************************************************华丽的分割线********************************************* ...

  5. Codeforces 475C Kamal-ol-molk's Painting 模拟

    主题链接:点击打开链接 意甲冠军:特定n*m矩阵 X代表色 .代表无色 随着x*y形刷子去涂色. 刷子每次能够→或↓移动随意步. 若可以染出给定的矩阵,则输出最小的刷子的面积 若不能输出-1 思路: ...

  6. Design Pattern——单一职责原理

    在类的职责分离上多考虑,做到单一职责,这样的代码才能做到易于维护,易扩展,灵活多样.

  7. BZOJ_4867_[Ynoi2017]舌尖上的由乃_分块+dfs序

    BZOJ_4867_[Ynoi2017]舌尖上的由乃_分块+dfs序 Description 由乃为了吃到最传统最纯净的美食,决定亲自开垦一片菜园.现有一片空地,由乃已经规划n个地点准备种上蔬菜.最新 ...

  8. JS ArrayBuffer和String

    http://blog.mn886.net/chenjianhua/show/6b02fa4173ed/index.html ArrayBuffer和String 互相转换 function str2 ...

  9. c++中为什么可以通过指针或引用实现多态,而不可以通过对象呢?

    引言:  在c++中司空见惯的事情就是:可以通过指针和引用可以实现多态,而对象不可以.  那为什么?让我们来解开这神秘的暗纱! 1. 类对象的存储方式: 在一个类的实例中,只会存放非静态的成员变量. ...

  10. Selenium Webdriver 的 PageObject 改造

    PageObject中提供了一个@FindBy注解,也非常好用,但由于其是一次性全部初始化所有的WebElement,对于当前还不存在于页面上的Element在初始化时就会报错,为了解决这个问题,自然 ...