java - Can I marshal my own data structures with JAXB? -


i using own iterable structures - various binarytrees. can marshal them? it's quite easy marshal f.e. java.util.list implementations, in case, it's absolutely unacceptable. need use own structures, no internal containers whatsoever - memory chains (root.leftson.rightson etc.)

in other words, possible marshall structure like:

class binarytree<t> implements iterable<t> ?

edit: structure supposed (for binarytree<person>):

<persons>  <person>    <name>john</name>    <surname>black</name>  </person>  <person>    <name>joe</name>    <surname>blue</name>  </person> </persons> 

so when add annotation structure like:

@xmlelement private binarytree<person> persons = new binarytree<person>(); public binarytree<person> getpersons() { return persons; } 

,it creates empty element <persons />. tried @xmlelementwrapper annotations, won't take custom structure (must collection or similar). nice have @iterableelement or :)

there guide on how own marshalling methods in javadoc of xmladapter. way, using @xmljavaadapter annotation, can define how want marshal class.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -