* <li>the full class name, with '.' and '$' replaced by '_'.</li>
* </ul>
*/
private static String generateFormBeanName( Class formBeanClass, HttpServletRequest request )
{
ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request );
String formBeanClassName = formBeanClass.getName();
//
// A form-bean wasn't found for this type, so we'll create a name. First try and create
// name that is a camelcased version of the classname without all of its package/outer-class
// qualifiers. If one with that name already exists, munge the fully-qualified classname.
//
String formType = formBeanClassName;
int lastQualifier = formType.lastIndexOf( '$' );
if ( lastQualifier == -1 )
{
lastQualifier = formType.lastIndexOf( '.' );
}
String formName = formType.substring( lastQualifier + 1 );
formName = Character.toLowerCase( formName.charAt( 0 ) ) + formName.substring( 1 );
if ( moduleConfig.findFormBeanConfig( formName ) != null )
{
formName = formType.replace( '.', '_' ).replace( '$', '_' );
assert moduleConfig.findFormBeanConfig( formName ) == null : formName;
}
return formName;
}