Showing posts with label Inheritance. Show all posts
Showing posts with label Inheritance. Show all posts

August 11, 2012

JAXB's @XmlTransient and Property Order

In previous articles I wrote about how the @XmlTransient annotation can be used at the type level to have a class excluded from the inheritance hierarchy, or at the field/property level to unmap a field/property.  In this article I'll demonstrate how doing this impacts the propOrder setting on the @XmlType annotation.

February 6, 2012

JAXB and Inheritance - EclipseLink MOXy's @XmlClassExtractor

In a previous post I covered how JAXB's XmlAdapter could be leveraged to use a node unique to the subtype as the inheritance indicator.  In this post I'll demonstrate that if that node is an XML attribute, then EclipseLink JAXB (MOXy)'s @XmlClassExtractor could be leveraged to do the same thing in fewer lines of code.

January 25, 2012

JAXB and Inheritance - Using XmlAdapter

In previous posts I have covered how to map inheritance relationships in JAXB. This can be done by element name (via @XmlElementRef), by the xsi:type attribute, or in EclipseLink MOXy using another XML attribute (via @XmlDescriminatorNode/@XmlDescriminatorValue).  In this post the type indicator will be an XML attribute/element unique to that type, and we will leverage an XmlAdapter to implement this behaviour.

June 1, 2011

Ignoring Inheritance with @XmlTransient

In previous articles I have covered how to map inheritance relationships in JAXB and EclipseLink MOXy.  In this example I will describe how to remove an inheritance relationship in JAXB by leveraging @XmlTransient at the type level.

November 5, 2010

JAXB and Inheritance - MOXy Extension @XmlDescriminatorNode/@XmlDescrimintatorValue

In previous blog posts I described how to leverage the xsi:type attribute and substitution groups to represent inheritance.  In this post I'll demonstrate how an upcoming EclipseLink 2.2 JAXB (MOXy) extension can be used to represent inheritance.  It leverages an attribute of your own choosing to represent the subtype.  If you are using a version of EclipseLink prior to 2.2 you can use the technique described here.

November 4, 2010

JAXB and Inheritance - Using Substitution Groups

In a previous blog post I described how to leverage the xsi:type attribute to represent inheritance.  In this post I'll demonstrate how to use the element name instead by leveraging the XML Schema concept of substitution groups.

JAXB and Inheritance - Using the xsi:type Attribute

In a previous blog post I was challenged by an Xstream user to describe how JAXB handles inheritance.  In this post I'll describe one strategy that can be used, and how easily this can be done with JAXB.  I'll discuss alternate strategies in future posts.