Joshua's suggestion of get/set methods will work.

You can also do the same thing using a <format> definition. Just define
the <format> as applying to type Set, and reference the <format> within
the Role class <mapping>. See the tutorial section on custom serializers
and deserializers:
http://jibx.sourceforge.net/tutorial/binding-extend.html#serdeser The
serializer will take the Set and generate the string consisting of space
separated User ids, while the deserializer will take a string of this
type and return the corresponding Set.

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Davies, Joshua wrote:
> Do you really need a customer unmarshaller for this?  I would just specialize 
> the setter/getter in "Role":
> class Role {
>   private Set<User> users;
>   public void setUsers( String spaceDelimitedUsers )  {       for ( String 
> userId : spaceDelimitedUsers.split( " " ) )        {               users.add( 
> new User( userId ) );        }  }
>   public String getUsers( )  {        String strUsers = "";
>       for ( User user : users )       {               strUsers += user.getId( 
> ) + " ";        }
>       return strUsers;  }
> -----Original Message-----From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> On Behalf Of ????????? ????????Sent: Friday, August 31, 2007 9:54 AMTo: 
> [EMAIL PROTECTED]: Re: [jibx-users] item-type at runtime?
> Hello!
>
>
> I have an objects like this:
> class User {
>   private Integer id;
> }
>
>
> class Role {
>   private Set<User> users;
>   ...
> }
>
>
> I want receive following document after murshalling:
> <role>
>   <users>1 4 6 78</users>
> </role>
>
>
> ... node "users" must contain only "id" of objects "User".
>
>
> And I want get Set of "User"-objects after unmarshalling. But have no 
> information about item-type in my custom marshaller/unmarshaller.
>
>
> Could you help me?
>
>
> P.S. Sorry for my English =))
>
>
> 31.08.07, 14:24, Dennis Sosnoski ([EMAIL PROTECTED]):
>
>
>   
>> There's currently no way to do this. What's the situation, perhaps I can
>> suggest a workaround.
>>   - Dennis
>> Dennis M. Sosnoski
>> SOA and Web Services in Java
>> Training and Consulting
>> http://www.sosnoski.com - http://www.sosnoski.co.nz
>> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>> Бронников Владимир wrote:
>>     
>>> Hello.
>>>
>>>
>>> How can I get value of "item-type" attribute at runtime in my custom 
>>> marshaller/unmurshaller?
>>>
>>>
>>> --
>>> С уважением, Бронников Владимир
>>> -------------------------------------------------------------------------This
>>>  SF.net email is sponsored by: Splunk Inc.Still grepping through log files 
>>> to find problems?  Stop.Now Search log events and configuration files using 
>>> AJAX and a browser.Download your FREE copy of Splunk now >>  
>>> http://get.splunk.com/_______________________________________________jibx-users
>>>  mailing [EMAIL PROTECTED]://lists.sourceforge.net/lists/listinfo/jibx-users
>>>
>>>   
>>>       
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems?  Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >>  http://get.splunk.com/
>> _______________________________________________
>> jibx-users mailing list
>> jibx-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>     
>
>
> --
> С уважением, Бронников Владимир
> -------------------------------------------------------------------------This 
> SF.net email is sponsored by: Splunk Inc.Still grepping through log files to 
> find problems?  Stop.Now Search log events and configuration files using AJAX 
> and a browser.Download your FREE copy of Splunk now >>  
> http://get.splunk.com/_______________________________________________jibx-users
>  mailing [EMAIL PROTECTED]://lists.sourceforge.net/lists/listinfo/jibx-users
> -------------------------------------------------------------------------This 
> SF.net email is sponsored by: Splunk Inc.Still grepping through log files to 
> find problems?  Stop.Now Search log events and configuration files using AJAX 
> and a browser.Download your FREE copy of Splunk now >>  
> http://get.splunk.com/_______________________________________________jibx-users
>  mailing [EMAIL PROTECTED]://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to