Java Path File Name nio getClassName(Path pluginImplementationDirectory, Path classFile)

Here you can find the source of getClassName(Path pluginImplementationDirectory, Path classFile)

Description

get Class Name

License

Apache License

Declaration

private static String getClassName(Path pluginImplementationDirectory, Path classFile) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.file.Path;

public class Main {
    private static final String PACKAGE_SEPARATOR = ".";
    private static final String CLASS_FILE_EXTENSION = ".class";
    private static final String JAR_DIRECTORY_SEPARATOR = "/";

    private static String getClassName(Path pluginImplementationDirectory, Path classFile) {
        String className = pluginImplementationDirectory.relativize(classFile).toString()
                .replace(JAR_DIRECTORY_SEPARATOR, PACKAGE_SEPARATOR).replace(CLASS_FILE_EXTENSION, "");
        if (className.startsWith(PACKAGE_SEPARATOR) && className.length() > 1) {
            className = className.substring(1);
        }/*from w w w.ja  v  a  2 s.  c  o m*/
        return className;
    }
}

Related

  1. getAbsolutePath(String name)
  2. getAbsolutePathName(File dir)
  3. getAllFiles(List fileNames, Path path)
  4. getArtifactName(Path artifactPath)
  5. getBandNameStr(Path filePath)
  6. getConfigurationFile(String installPath, String serverName)
  7. getConfigurationFilePath(String name)
  8. getContentPath(Path zipFilePath, String contentFileName)
  9. getDatabaseDirectoryPath(String databaseDirectory, String name)