users@jaxb.java.net

Interesting annotations mapping problem

From: Vladimir Blagojevic <dovlex_at_gmail.com>
Date: Mon, 20 Jul 2009 21:51:43 +0200

Hi,

I would like to map a class with a fairly flat structure (fields are
either primitives or String) to a xml structure that is not so flat. Let
me explain. Say there is a Person class:

public class Person {

     String name;
     int age;
     String occupation;
     String occupationPosition;
     String streetAddress;
     String cityAddress;
     ....


I would like to group occupation related string fields into <occupation>
element with two attributes say type and position and in a similar
fashion address related string fields into <address> element.

Any ideas how to achieve this type of mapping?

Best regards,
Vladimir