protected String changeCase ( String originalString , String mode ) { String targetString = originalString ; // mode is case insensitive, allow upper for example CaseFormatMode changeCaseMode = CaseFormatMode . get ( mode . toUpperCase ( ) ) ; if ( changeCaseMode != null ) { switch ( changeCaseMode ) { case LOWER_CAMEL_CASE : targetString = camelFormat ( originalString , false ) ; break ; case UPPER_CAMEL_CASE : targetString = camelFormat ( originalString , true ) ; break ; case SNAKE_CASE : case LOWER_UNDERSCORE : targetString = caseFormatWithDelimiter ( originalString , UNDERSCORE , false , true ) ; break ; case KEBAB_CASE : case LISP_CASE : case SPINAL_CASE : case LOWER_HYPHEN : targetString = caseFormatWithDelimiter ( originalString , HYPHEN_MINUS , false , true ) ; break ; case TRAIN_CASE : targetString = caseFormatWithDelimiter ( originalString , HYPHEN_MINUS , true , false ) ; break ; case UPPER_UNDERSCORE : targetString = caseFormatWithDelimiter ( originalString , UNDERSCORE , true , false ) ; break ; default : // default not doing nothing to originalString } } else { LOGGER . error ( "Unknown mode {}, returning {} unchanged" , mode , targetString ) ; } return targetString ; }
Change case options