1

How do I marshal a list of JAXB annotated objects without creating another class whose sole purpose is to be a container for the annotated objects?

Say I have this list:

List<MyObj> myList = new ArrayList<>();

List is a great container for objects, how can I marshal myList? I'm looking for an example that takes about 4 lines of code (about how much it takes to marshal a single MyObj instance) without creating any special helper classes.

I would accept an answer that had a generic helper class that could hold an arbitrary object type, like the List interface or the ArrayList class. That way I could reuse the helper class for all my applications.

Jason
  • 11,709
  • 9
  • 66
  • 82
  • possible duplicate of [Is it possible to programmatically configure JAXB?](http://stackoverflow.com/questions/13272288/is-it-possible-to-programmatically-configure-jaxb) – bdoughan Feb 20 '14 at 18:14
  • Yes, it is a duplicate of that question, though I think the question title here is a bit more clear :-) – Jason Feb 20 '14 at 18:41
  • I agree your title is better. – bdoughan Feb 20 '14 at 18:50

0 Answers0