users@jaxb.java.net

Re: Custom mapping for Maps in JAXB

From: Leo Romanoff <romixlev_at_yahoo.com>
Date: Wed, 16 Jun 2010 11:14:41 -0700 (PDT)

Hi,

Has anyone more concrete and constructive comments on this issue?

Is it possible to produce custom serialization using standard JAXB tricks?
If not, is there any way to extend JAXB by means of a custom "plugin" to
support custom serialization and deserialization of specific parts of the
overall object graph? For example, every map field marked by a special
annotation could produce a top-level tag <map> and inside it for each
key/value pair (K,V) it would produce <K>V</K> thus resulting in something
like:
  <map>
     <K1>V1</K1>
     <K2>V2</K2>
     ...
     <Kn>Vn</Kn>
  </map>

As custom section is clearly marked by <map> tags, it should be actually
pretty straight forward for JAXB to detect it and to call a user-defined
custom handler for unmarshalling the enclosed XML fragment. Of course, it
would only work if JAXB would support this type of custom handlers.

Do you think this idea makes sense? Is it possible to implement something
like this?

Thanks,
  Leo
-- 
View this message in context: http://old.nabble.com/Custom-mapping-for-Maps-in-JAXB-tp28779221p28905884.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.