Details
Description
Given a class with two fields using the same file handler:
<field-handler name="echoFieldHandler" class="bugs.cFILE_HANDLER.EchoFieldHandler"/> <class name="bugs.cFILE_HANDLER.Entity"> <map-to xml="entity" /> <field name="firstName" type="string" handler="echoFieldHandler"/> <field name="lastName" type="string" handler="echoFieldHandler"/> </class>
The marshalled xml will contain in every element using the handler the value coming from the last field using the handler. I.e. the value of lastName will be used in firstName as well.
I attached a testCase.
In this screenshot taken during the debugging session of my application. Here you can see the object graph of two fieldDescriptors: one for the startDate field and another for an endDate field. Both descriptors have a custom fieldHandler to marshall JodaLocalDateTime properties, nested in another FieldHandlerImpl. The JodaLocalDateTimeHandler instance is the same for both startDate and endDate, but the instance itself contains a field descriptor pointing to endDate, that will determine which value of the class to be will be extracted.
The mapping file used in my application is similar to the one in the test-case: a single field handler referenced by two field in the same class.