Annotation Interface Order


@Retention(RUNTIME) public @interface Order
The Order annotation is used to specify the order of appearance of XML elements and attributes. When used it ensures that on serialization the XML generated is predictable. By default serialization of fields is done in declaration order.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies the appearance order of the XML attributes within the generated document.
    Specifies the appearance order of the XML elements within the generated document.
  • Element Details

    • elements

      String[] elements
      Specifies the appearance order of the XML elements within the generated document. This overrides the default order used, which is the declaration order within the class. If an element is not specified within this array then its order will be the appearance order directly after the last specified element.
      Returns:
      an ordered array of elements representing order
      Default:
      {}
    • attributes

      String[] attributes
      Specifies the appearance order of the XML attributes within the generated document. This overrides the default order used, which is the declaration order within the class. If an attribute is not specified within this array then its order will be the appearance order directly after the last specified attribute.
      Returns:
      an ordered array of attributes representing order
      Default:
      {}