[jboss-dev-forums] [Design of POJO Server] - Re: JAXBDeployer

jason.greene@jboss.com do-not-reply at jboss.com
Wed Jan 24 14:57:23 EST 2007


"adrian at jboss.org" wrote : 
  | The latest version has resolved many of these issues, although there
  | are still a number of features missing, e.g. dynamic wildcard handling
  | like JBossXB can do.
  | 
  | e.g. the recent spring integration code lets you mix and match
  | JBoss MC and Spring xml in the same file:
  | 
  |   | <?xml version="1.0" encoding="UTF-8"?>
  |   | 
  |   | <deployment xmlns="urn:jboss:bean-deployer:2.0">
  |   | 
  |   |    <!-- Microcontainer xml -->
  |   |    <bean name="oldBean" class="org.jboss.test.spring.support.OldBean">
  |   |       <property name="testBean"><inject/></property>
  |   |    </bean>
  |   | 
  |   |    <!-- Spring xml - via a wildcard binding -->
  |   |    <bean xmlns="urn:jboss:spring-beans:2.0" id="testBean" class="org.jboss.test.spring.support.SimpleBean">
  |   |       <property name="mylist">
  |   |          <list value-type="java.lang.String">
  |   |             <value>onel</value>
  |   |             <value>twol</value>
  |   |             <value>threel</value>
  |   |          </list>
  |   |       </property>
  |   |    </bean>
  |   | 
  |   | </deployment>
  |   | 
  | 
This is possible in JAXB, if you have the following in your root type: 

  |   // Array of Element or JAXB elements.
  |  @XmlAnyElement(lax="true")
  |  public Object[] others;
  | 

JAXB dynamically resolves type information off of annotations. So before unmarshalling, if you pass the JAXBContext a FooType.class. and FooType has an @XmlElementRoot, and the unmarshalled value matches that declaration, then "others" would contain an instance of FooType. Unknown elements would present a DOM Element.

-Jason

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005984#4005984

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005984



More information about the jboss-dev-forums mailing list