Hi Michael,

I've tried this and it works - I don't know if there is a simpler way to 
achieve it.

Add a factory method to AbstractPrivilege:

/* private access privilege works with JibX */

private static Set<ObjectNames> objectNamesFactory () {
     return EnumSet.noneOf(ObjectNames.class);
}

The binding that I've used is somewhat as follows:

    <mapping class="AbstractPrivilege" name="privilege">
         <collection field="objectNames" type="java.util.EnumSet"
            name="object-names"
            factory="AbstractPrivilege.objectNamesFactory">
            <value name="object-name" type="ObjectName"/>
         </collection>
    </mapping>

Hope this helps.

Satish

Dennis Sosnoski wrote:
> Hi Michael,
>
> I haven't tried this, but since EnumSet is just a specialized collection 
> you should be able to do something along the following lines:
>
>   <collection name="privileges" get-method="getObjectNames" 
> set-method="setObjectNames">
>     <value name="name" type="...AbstractPrivilege$ObjectNames"/>
>   <collection>
>
>   - 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
>
>
>
> Michael Librodo wrote:
>   
>> realized that I didnt turn off the rich text formatting.. here is the 
>> original message and code... Sorry
>>
>> Hi all-I'm fairly new to JiBX and the tool is quite impressive. After some 
>> proof of concept work, I was able to decrease our serialization time by at 
>> least a factor of 10. So I am going ahead and working on replacing the 
>> present serialization solution with JiBX. Up until the issue that I am 
>> mentioning in this post, the work to migrate to JiBX has been relatively 
>> easy. The problem that I am now encountering is determining an appropriate 
>> binding file for a class that employs a java.util.enumset and an embedded 
>> enum. I have searched the mailing list but to no avail. Any help would be 
>> appreciate. Here is the class i'm trying to serialize.Thanks in advance-
>>
>> ////////////////////STARTCODE////////////////////////////////
>> import java.util.EnumSet;
>>
>> public abstract class AbstractPrivilege {
>>     public EnumSet<ObjectNames> objectNames = 
>> EnumSet.noneOf(ObjectNames.class);
>>     public abstract String getPrivilege();
>>
>>     /// Getters/Setters  ///
>>     public EnumSet<ObjectNames> getObjectNames() {
>>         return objectNames;
>>     }
>>
>>     public void setObjectNames(EnumSet<ObjectNames> objectNames) {
>>         this.objectNames = objectNames;
>>     }
>>
>>     //////// Enums  ////////
>>     public static enum ObjectNames {ACTION, ACTIONGROUP, TESTPROCEDURE,
>>         TESTCASE, GLOBALPARAMETER, PROJECTSETTING, TESTRUN, TESTSUITE
>>     }
>> }
>>
>> ////////////////////ENDCODE//////////////////////////////////
>>
>>   
>>     
>>> From: Michael Librodo Reply-To: JiBX users To: Subject: [jibx-users] Help 
>>> writing binding file for an enumset collection Date: Tue, 6 Mar 2007 
>>> 17:59:58 -0800
>>>
>>> Hi all-I'm fairly new to JiBX and the tool is quite impressive. After some 
>>> proof of concept work, I was able to decrease our serialization time by at 
>>> least a factor of 10. So I am going ahead and working on replacing the 
>>> present serialization solution with JiBX. Up until the issue that I am 
>>> mentioning in this post, the work to migrate to JiBX has been relatively 
>>> easy. The problem that I am now encountering is determining an appropriate 
>>> binding file for a class that employs a java.util.enumset and an embedded 
>>> enum. I have searched the mailing list but to no avail. Any help would be 
>>> appreciate. Here is the class i'm trying to serialize.Thanks in 
>>> advance-////////////////////STARTCODE////////////////////////////////import 
>>> java.util.EnumSet;public abstract class AbstractPrivilege {    public 
>>> EnumSet objectNames = EnumSet.noneOf(ObjectNames.class);    public abstract 
>>> String getPrivilege();    /// Getters/Setters  ///    public EnumSet 
>>> getObjectNames() {        return objectNames;    }    public void 
>>> setObjectNames(EnumSet objectNames) {        this.objectNames = 
>>> objectNames;    }    //////// Enums  ////////    public static enum 
>>> ObjectNames {ACTION, ACTIONGROUP, TESTPROCEDURE,         TESTCASE, 
>>> GLOBALPARAMETER, PROJECTSETTING, TESTRUN, TESTSUITE    
>>> }}////////////////////ENDCODE////////////////////////////////// 
>>> _________________________________________________________________ Invite 
>>> your mail contacts to join your friends list with Windows Live Spaces. It's 
>>> easy! 
>>> http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
>>>  
>>> ------------------------------------------------------------------------- 
>>> 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 
>>> [email protected] 
>>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>>     
>>>       
>> _________________________________________________________________
>> Mortgage rates as low as 4.625% - Refinance $150,000 loan for $579 a month. 
>> Intro*Terms  
>> https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h27f6&disc=y&vers=743&s=4056&p=5117
>>
>>
>> -------------------------------------------------------------------------
>> 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
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>
>>   
>>     
>
> -------------------------------------------------------------------------
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to