JAXB xjc Compiler Content Tree Generation Issue

The JAXB xjc compiler created a generic content tree called “content” in the type of List<Object>, which is too generic for use.  Ideally, xjc should create a content tree with specific types (e.g. List<Type>).  JAXB calls this generic property (i.e. List<Object> content) the “catch-all” property.  The accessors for this property are generic as well -List<Object> getContent().  After many hours of hacking the XML schemas, I realized the generated class has the reason as part of its comments on why xjc created a generic property instead of type specific properties.  I should’ve known.

In conclusion, if the xjc compiler isn’t generating what you are expecting, check the comments in the generated java code first.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s