Class CodeGenerationUtils
java.lang.Object
com.github.javaparser.utils.CodeGenerationUtils
Utilities that can be useful when generating code.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PathclassLoaderRoot(Class<?> c) static StringA shortcut to String.format.static PathfileInPackageAbsolutePath(String root, String pkg, String file) Calculates the path to a file in a package.static PathfileInPackageAbsolutePath(Path root, String pkg, String file) static PathfileInPackageRelativePath(String pkg, String file) Turns a package and a file into a relative path.static StringgetterName(Class<?> type, String name) static StringgetterToPropertyName(String getterName) static PathmavenModuleRoot(Class<?> c) Useful for locating source code in your Maven project.static StringoptionalOf(String text, boolean isOptional) static PathpackageAbsolutePath(String root, String pkg) Calculates the path of a package.static PathpackageAbsolutePath(Path root, String pkg) static StringpackageToPath(String pkg) Converts a package name like "com.laamella.parser" to a path like "com/laamella/parser"static StringsetterName(String fieldName) static PathsubtractPaths(Path full, Path difference) Shortens path "full" by cutting "difference" off the end of it.
-
Constructor Details
-
CodeGenerationUtils
private CodeGenerationUtils()
-
-
Method Details
-
getterName
-
getterToPropertyName
-
setterName
-
optionalOf
-
f
-
fileInPackageAbsolutePath
Calculates the path to a file in a package.- Parameters:
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.
-
fileInPackageAbsolutePath
-
fileInPackageRelativePath
-
packageToPath
-
packageAbsolutePath
-
packageAbsolutePath
-
classLoaderRoot
-
mavenModuleRoot
-
subtractPaths
-