カスタムJiBXマーシャラを作成して動作確認しました。カスタムJiBXマーシャラとのマッピング
<binding xmlns:tns="http://foobar.com/foo" direction="output">
<namespace uri="http://foobar.com/foo" default="elements"/>
<mapping class="java.util.HashMap" marshaller="com.foobar.Marshaller1"/>
<mapping name="context" class="com.foobar.Context">
<structure field="configuration"/>
</mapping>
</binding>
ただし、異なるHashMap用に複数のマーシャラーを作成する必要があります。だから私はこのような抽象的マッピングとそれを参照しようとしました:
<binding xmlns:tns="http://foobar.com/foo" direction="output">
<namespace uri="http://foobar.com/foo" default="elements"/>
<mapping abstract="true" type-name="configuration" class="java.util.HashMap" marshaller="com.foobar.Marshaller1"/>
<mapping abstract="true" type-name="overrides" class="java.util.HashMap" marshaller="com.foobar.Marshaller2"/>
<mapping name="context" class="com.foobar.Context">
<structure map-as="configuration" field="configuration"/>
<structure map-as="overrides" field="overrides"/>
</mapping>
</binding>
私は結合を構築しようとしたとき、そうするときしかし、私は次のように受信します。
Error during code generation for file "E:\project\src\main\jibx\foo.jibx" - this may be due to an error in your binding or classpath, or to an error in the JiBX code
私の推測では、私はどちらかということです抽象マッピングのために私のカスタムマーシャラーを有効にするために実装する必要のあるものがないか、カスタムマーシャラーが抽象マッピングをサポートしていない。
私はJiBX API(http://jibx.sourceforge.net/api/org/jibx/runtime/IAbstractMarshaller.html)でIAbstractMarshallerインターフェイスを見つけましたが、これが実装する必要がある場合はドキュメントがわかりません。私はこのインターフェースの実装を見つけることができませんでした。
私の質問は、カスタムマーシャル(可能であれば)との抽象マッピングをどのようにしますか?それがIAbstractMarshallerインターフェイス経由で行われている場合、どのように動作しますか、それとも実装する必要がありますか?