string-notation / de.joshuagleitze.stringnotation / JavaPackagePart

JavaPackagePart

object JavaPackagePart : BaseStringNotation

A notation for java package parts. When printing, it simply concatenates all word parts and drops any character that is not allowed in a Java identifier. If the result is a Java keyword, _ will be appended to it. When parsing, the notation will recognise word parts both in the LowerCamelCase and the SnakeCase notation. However, neither notation is conventional and parsing will usually yield only one word part on real-world inputs.

Allowed characters are determined using Character.isJavaIdentifierStart and Character.isJavaIdentifierPart. Keywords are detected using SourceVersion.isKeyword.

Functions

print

Transforms a Word into a string that is formatted according to this notation.

fun print(word: Word): String

transformPartAfterParse

Transforms a parsed part after it has been read. The default implementation does not change the part.

fun transformPartAfterParse(index: Int, part: String): String

transformPartToPrint

Allows to transform a part before it is being printed. The default implementation does not modify the part in any way.

fun transformPartToPrint(index: Int, part: String): String