Right, I wanted @XmlElementWrapper to unwrap the module element and not have a wrapping Module class.
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.greene@jboss.com" wrote:
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.
<module> <connector>mq.jar</connector> <alt-dd>foo/alt.xml</alt-dd> </module>
Yes, and there is also the id attribute on the module. We did end up using a module wrapper with this info in the metadata project.