Hi Ralf,

Thanks for the info.  I started wondering about that too, that there may be some cases where case insensitivity is not desired.  I will work on making this configurable, and then open a bug as you asked.

Thanks for the help.

-Will

Ralf Joachim wrote:
Hi Will,

could you please open a new issue in jira and attach your diff to it. If
possible we would prefer if your diff would be in unified format (diff -u).

Having said that there may also be users that count on the case
sensitivite of the enumerated values. Therefore I think your patch will
not make it into CVS as is. What do you think of making this feature
configurable from the command line with default being case sensitive.

Regards
Ralf
Castor JDO, committer


Will McKinley schrieb:
  
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]
-------------------------------------------------
    

  

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

Reply via email to