public final class CodeGenerationUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Path |
classLoaderRoot(Class<?> c) |
static String |
f(String format,
Object... params)
A shortcut to String.format.
|
static Path |
fileInPackageAbsolutePath(Path root,
String pkg,
String file) |
static Path |
fileInPackageAbsolutePath(String root,
String pkg,
String file)
Calculates the path to a file in a package.
|
static Path |
fileInPackageRelativePath(String pkg,
String file)
Turns a package and a file into a relative path.
|
static String |
getterName(Class<?> type,
String name) |
static String |
getterToPropertyName(String getterName) |
static Path |
mavenModuleRoot(Class<?> c)
Useful for locating source code in your Maven project.
|
static String |
optionalOf(String text,
boolean isOptional) |
static Path |
packageAbsolutePath(Path root,
String pkg) |
static Path |
packageAbsolutePath(String root,
String pkg)
Calculates the path of a package.
|
static String |
packageToPath(String pkg)
Converts a package name like "com.laamella.parser" to a path like "com/laamella/parser"
|
static String |
setterName(String fieldName) |
static Path |
subtractPaths(Path full,
Path difference)
Shortens path "full" by cutting "difference" off the end of it.
|
public static Path fileInPackageAbsolutePath(String root, String pkg, String file)
root
- the root directory in which the package residespkg
- the package in which the file resides, like "com.laamella.parser"file
- the filename of the file in the package.public static Path fileInPackageAbsolutePath(Path root, String pkg, String file)
public static Path fileInPackageRelativePath(String pkg, String file)
public static String packageToPath(String pkg)
public static Path packageAbsolutePath(String root, String pkg)
root
- the root directory in which the package residespkg
- the package, like "com.laamella.parser"public static Path classLoaderRoot(Class<?> c)
public static Path mavenModuleRoot(Class<?> c)
Copyright © 2007–2020. All rights reserved.