private static String stripAnonymousPart ( final String className ) { for ( int index = className . indexOf ( "$" , 0 ) ; index != - 1 ; index = className . indexOf ( ' ' , index + 2 ) ) { /* Trailing dollar sign */ if ( index >= className . length ( ) - 1 ) { return className . substring ( 0 , index ) ; } char firstLetter = className . charAt ( index + 1 ) ; /* First letter after dollar sign is not a capital letter of a named inner class */ if ( firstLetter < ' ' || firstLetter > ' ' ) { return className . substring ( 0 , index ) ; } } return className ; }
Strips the the anonymous part from a class name .