java - Embedded attributes in JAXB class -


i need map legacy xml can't change. there several elements have hundreds attributes same other elements. attributes have same name postfixed number. xml might this:

<someelement custom1="..." custom2="..." custom78=".."/> <anotherelmenent custom1="..." custom45="..."/> 

a solution "works" create base class so:

@xmlaccessortype(field) public class lotsacustomids {     @xmlattribute     private string custom1;      @xmlattribute     private string custom2;  ... }  @xmltype public class someelement extends lotsacustomids {         .... } 

but it's shame use inheritence here, since java has single inheritence. i'd way jpa/hibernate embedded objects, like:

@xmltype public class someelement {     @embeddedattributes     private lotsacustomids customids;         .... } 

anyway this?

note: i'm eclipselink jaxb (moxy) lead.

you use moxy's @xmlpath extension map use case. when use @xmlpath(".") pull contents of child object (lotsacustomids) parent object (someelement).

@xmltype public class someelement {     @xmlpath(".")     private lotsacustomids customids;         .... } 

related information blog


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -