Christian wrote:
>> Hi,
>> I have the following problem:
>>
>> I have a class that looks like this (and cannot be changed):
>>
>> public class Property{
>>
>>      private String name;
>>      private Object value;
>> }
>>
>> The value attribute will contain only the Wrapper objects of the  
>> primitive data types (e.g. Long, Boolean, ...) or a String. But it  
>> can contain any of those values.
>> If I try to bind this object with the following binding:
>>
>>      <mapping name="property" class="mypackage.Property">
>>              <value name="name" field="name" usage="required"/>
>>              <value name="value" field="value" usage="required"/>
>>      </mapping>
>>
>> I get the following Exception when I run the binding compiler:
>>
>> Error: Need deserializer or constructor from string for type  
>> java.lang.Object for value element at  ....
>>
>> I know that JIBX cannot marshall some arbitrary Object, but it can  
>> marshall basic types and all other objects I have defined in my  
>> binding definition.
>>
>> Can I tell JIBX somehow that only those kind of objects will be  
>> saved in the value attribute at runtime? Or is there another  
>> workaround for this problem?
>>
        You will need to use a custom (de)serializer method for the value. 
Review the documentation on the custom deserializer methods in the Jibx 
documentation. Because you are only converting values to base type, this 
should be simple to do.

-- 
        Thomas Jones-Low            Softstart Services Inc.
        [EMAIL PROTECTED]      JobScheduler for Oracle
        Ph: 802-398-1012            http://www.softstart.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to