jibx adding members to a collection via multiple xml files
We're using jibx for our configurations and everything works well so far.
I'd like to take one of my mapped objects and have a collection currently configured on that object be configurable by multiple xml files, one for each object in the collection.
<collection field="widgets" factory="org.jibx.runtime.Utility.arrayListFactory" usage="optional">
<structure name="widget" map-as="Widget"/>
</collection>
Such that for each widget in widgets I can have a widget-{n}.xml file and read all widgets defined in the config directory into my collection.
My approach so far has been to configure a file name pattern within the jibx specification for Widget and read the files from the directory within that method.
However, I feel that jibx should have an already defined way of dealing with adding members to a collection via multiple xml files.
Does anybody know that jibx is capable of this? Searching the jibx开发者_JAVA技巧 documentation has not been helpful.
What I did was created a second jibx mapping for the objects in the collection. The original object mapping contained a config to specify the pattern for the new configuration files.
Then I wrote code in the original object to read the new config files and fill the collection.
精彩评论