java - Jaxb Enums with subtype -
i have country enum.
@xmlenum public enum country { ....,es,fr,....; } country used in product:
public class product { ... @xmlelement(name = "country") private list<country> origin; ... } the produced output is:
<product> <name>egestas</name> <description>montes</description> <country>es</country> <country>fr</country> </product> the problem need produce kind of output.
<product> <name>egestas</name> <description>montes</description> <country> <id>es</id> </country> <country> <id>fr</id> </country> </product> how can produce later output enums without using adapter?
a
class country { private countryid id; //... } with
enum countryid { ..., es, fr,... } should produce xml requested.
later
of course, requires more code create element 1 additional layer.
product p = ...; country es = new country(); es.setid( countryid.es ); p.getcountry().add( es ); java enums jaxb
No comments:
Post a Comment