Java Jibx在多个结构中使用一个映射类变量

Java Jibx在多个结构中使用一个映射类变量,java,jibx,xml-binding,Java,Jibx,Xml Binding,我有以下映射: <mapping class="MainClass" abstract="true"> <structure name="SubAList" test-method="hasA" usage="optional" unmarshaller="com.test.MarshallA" marshaller=&q

我有以下映射:

<mapping class="MainClass" abstract="true">
    <structure name="SubAList" test-method="hasA" usage="optional" unmarshaller="com.test.MarshallA"
               marshaller="com.test.MarshallA">
    </structure>
    <structure name="SubBList" test-method="hasB" usage="optional">
        <collection add-method="addSubB" iter-method="createIterator" item-type="SubB" usage="optional">
            <structure name="SubB" usage="optional">
                <value style="attribute" name="identifier" get-method="getIdentifier" set-method="setIdentifier" usage="optional"/>
            </structure>
        </collection>
    </structure>
</mapping>


class MainClass {
    Collection<SubA> colA;
    Collection<SubB> colB;
    String valueForBoth = "abc";

    //.....
}

class SubA{
    // ......
}

class SubB{
    String identifier;
    //.....
}
<MainClass>
   <SubA valueForBoth="abc"/>
</MainClass>
<MainClass>
   <SubB valueForBoth="abc"/>
</MainClass>