JavaPackagePart

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

Link copied to clipboard
open override fun parse(sourceString: String): Word

Transforms an input string that is in this notation into a notation-agnostic Word.

Link copied to clipboard
open override fun print(word: Word): String

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

Link copied to clipboard
open override fun toString(): String