Search Results

Search found 1 results on 1 pages for 'aweigold'.

Page 1/1 | 1 

  • Abstract mapping with custom JiBX marshaller

    - by aweigold
    I have created a custom JiBX marshaller and verified it works. It works by doing something like the following: <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> However I need to create multiple marshallers for different HashMaps. So I tried to reference it with abstract mapping like this: <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> However when doing so, when I attempt to build the binding, I receive the following: 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 My guess is that either I'm missing something I need to implement to enable my custom marshaller for abstract mapping, or custom marshallers do not support abstract mapping. I have found the IAbstractMarshaller interface in the JiBX API (http://jibx.sourceforge.net/api/org/jibx/runtime/IAbstractMarshaller.html), however the documentation seems unclear to me on if this is what I need to implement, as well as how it works if so. I have not been able to find an implementation of this interface to work off of as an example. My question is, how do you do abstract mapping with custom marshallers (if it's possible)? If it is done via the IAbstractMarshaller interface, how does it work and/or how should I implement it?

    Read the article

1