jaxb annotations


Class level. Mark as Root

@XmlType(properOder={“field1”, “field2″…}

Class Level. Not root element and will be used inside the DOM tree.

notice the propOrder parameter of the @XmlType annotation. By default JAXB will order the elements alphabetically. Use the propOrder parameter to specify the order when marshaling to XML. The values are the bean names, not the overridden names in the @XmlElement(name = “overridenName”) annotation.


field/property level. Used as element\


filed/property level. Used for xml attribute


Class level . REFERENCE


PUBLIC_MEMBER is the default access type in JAXB.  It means that a JAXB implementation will generate bindings for:
  • public fields
  • annotated fields
  • properties


When the PROPERTY access type is used, JAXB implementations will generate bindings for:
  • annotated fields
  • properties
The use of access type FIELD will cause JAXB implementations to create bindings for:
  • fields
  • annotated properties
When access type NONE is used JAXB will create bindings for:
  • annotated fields
  • annotated properties


@XmlElementWrapper annotation on the List collection. This makes JAXB wrap all of the order XML elements inside of an orders XML element. This annotation can be used with an array instead of a List too


good for inheritence : reference

HERE is a good article


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s