Java Utililty Methods Package Convert To

List of utility methods to do Package Convert To

Description

The list of methods to do Package Convert To are organized into topic(s).

Method

StringpackageToDir(String packages)
package To Dir
String dir = packages;
if (packages != null && packages.length() > 1) {
    dir = packages.replaceAll("[.]", "/");
return dir;
StringpackageToDirectory(String sDestDir, String sPackage)
Return a directory path with the given directory + the given
String sPackageDir = sPackage.replace('.', '/');
if (sDestDir.endsWith("/") || sDestDir.endsWith("\\")) {
    return sDestDir + sPackageDir;
} else {
    return sDestDir + "/" + sPackageDir;
intPackageToInt(char pack)
get an Char into int depending on the package it represent
int iPack;
iPack = (int) pack - 65;
if (iPack >= 0 && iPack <= 25)
    return iPack;
else
    return 42;
StringpackageToPath(Class objClass)
package To Path
String className = objClass.getName();
int lastDotIndex = className.lastIndexOf(".");
return (lastDotIndex < 0) ? "" : className.substring(0, lastDotIndex).replace('.', '/');
StringpackageToPath(final String packageName)
Convert a java package name to a path.
return packageName.replace('.', '/');
StringpackageToPath(String basePackage)
package To Path
return basePackage.replaceAll("\\.", "/") + "/";
StringpackageToPath(String pkg)
package To Path
return "src/main/java/" + pkg.replace(".", "/");
StringpackageToResourcePath(String thePackage)
package To Resource Path
return thePackage.replaceAll("\\.", "/");
StringpackageToSrcFilePath(String packageName)
package To Src File Path
return packageName.replace(".", "/");