CodeGenerationUtils

Utilities that can be useful when generating code.

Functions

Link copied to clipboard
open fun classLoaderRoot(c: Class<out Any>): Path
Link copied to clipboard
open fun f(format: String, params: Array<Any>): String
A shortcut to String.format.
Link copied to clipboard
open fun fileInPackageAbsolutePath(root: String, pkg: String, file: String): Path
Calculates the path to a file in a package.
open fun fileInPackageAbsolutePath(root: Path, pkg: String, file: String): Path
Link copied to clipboard
Turns a package and a file into a relative path.
Link copied to clipboard
open fun getterName(type: Class<out Any>, name: String): String
Link copied to clipboard
open fun getterToPropertyName(getterName: String): String
Link copied to clipboard
open fun mavenModuleRoot(c: Class<out Any>): Path
Useful for locating source code in your Maven project.
Link copied to clipboard
open fun optionalOf(text: String, isOptional: Boolean): String
Link copied to clipboard
open fun packageAbsolutePath(root: String, pkg: String): Path
Calculates the path of a package.
open fun packageAbsolutePath(root: Path, pkg: String): Path
Link copied to clipboard
open fun packageToPath(pkg: String): String
Converts a package name like "com.laamella.
Link copied to clipboard
open fun setterName(fieldName: String): String
Link copied to clipboard
open fun subtractPaths(full: Path, difference: Path): Path
Shortens path "full" by cutting "difference" off the end of it.