Hi.

I'm new to Castor, but one of the features that I thought would be useful would be to generate code for Enumerated types based on a case insensitive lookup. This would allow value translation from "monday" to "Monday" so that the correct value is sent no matter how the user passed it into the type class.

I have modified org.exolab.castor.builder.SourceFactory locally. I have included the diff here.

1707a1708,1713
>
>         /**
>          * wml - 12/22/2005
> * Modifying the following line to perform lookups in a case insensitive
>          * manner.
>          *
1708a1715,1723
>          */
>         /*
>          * Begin new code.
>          */
>         jsc.append( "obj = _memberTable.get( string.toLowerCase() );" );
>         /**
>          * End new code.
>          */
>
1821a1837,1841
>             /**
>              * wlm - 12/22/2005
> * Modifying the following code section to allow case insensitive
>              * lookup of enumeration values.
>              *
1829a1850,1865
>              */
>             /**
>              * Begin new code.
>              */
>             if ( addInitializerCode )
>             {
>                 jsc = mInit.getSourceCode();
>                 jsc.add( "members.put( " );
>                 jsc.append( objName );
>                 jsc.append( ".toString().toLowerCase(), " );
>                 jsc.append( objName );
>                 jsc.append( " );" );
>             }
>             /**
>              * End new code.
>              */


Regards,
Will McKinley

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to