In CaseFormat, I had intentionally made the config value publicly accessible but didn't explain my reasoning behind it (my apologies):
Since the API is now extensible, clients might want to mix and match predefined formats with their own and the only way to do it in a concise manner would be something like this:
val formats = mapOf(
"SCREAMING_SNAKE_CASE" to CaseFormat.UPPER_UNDERSCORE.config,
"snake_case" to CaseFormat.LOWER_UNDERSCORE.config,
"Pascal.Dot.Case" to CaseFormatterConfig(false, ".", wordCapitalize = true, firstWordCapitalize = true)
)
val format : String = parseFormatFromConfigurationFile()
"Some words".toCase(formats["format"] ?: throw IllegalArgumentException("Unrecognised format"))