[jboss-dev-forums] [Design of JBossXB] - Re: @XmlElementWrapper/@XmlElements
jason.greene@jboss.com
do-not-reply at jboss.com
Fri Oct 12 16:02:31 EDT 2007
Ah Ok. For that We would need a spec (or proprietary) enhancment:
@XmlElementWrapper(eachElement=true)
You can do this with an adapter, but keep in mind this representation isn't a complete mapping to application.xml since you lose the alt-dd element.
|
| @XmlAccessorType(XmlAccessType.FIELD)
| @XmlType(name = "application")
| public class Foo2 {
| @XmlElement(required = true)
| @XmlJavaTypeAdapter(Adapter.class)
| public List<Component> module;
|
| @XmlAccessorType(XmlAccessType.FIELD)
| @XmlType(name = "")
| public static class Module {
| @XmlElements({
| @XmlElement(name="connector", type=Connector.class),
| @XmlElement(name="java", type=Java.class)
| })
| public Component component;
|
| @XmlElement(name="alt-dd")
| public String altDD;
| }
| public static interface Component
| {
| }
|
| public static class Connector implements Component
| {
| }
|
| public static class Java implements Component
| {
| }
|
| public static class Adapter extends XmlAdapter<Module, Component>
| {
|
| public Component unmarshal(Module module)
| {
| return module.component;
| }
|
| public Module marshal(Component component)
| {
| return null;
| }
| }
| }
|
-Jason
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094764#4094764
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094764
More information about the jboss-dev-forums
mailing list