public static File sourceFile(List<File> sourceRoots, String className) { FastStr s = FastStr.of(className).beforeFirst('$'); s = s.replace('.', File.separatorChar).append(".java"); for (File sourceRoot : sourceRoots) { File file = new File(sourceRoot, s.toString()); if (file.canRead()) { return file; } } return null; }
public static String sourceFileNameToClassName(File baseDir, String filePath) { if (!filePath.endsWith(".java")) { return null; } FastStr path0 = FastStr.of(baseDir.getAbsolutePath()); FastStr path1 = FastStr.of(filePath); if (File.separatorChar != '/') { path0 = path0.replace(File.separatorChar, '/'); path1 = path1.replace(File.separatorChar, '/'); } FastStr ret = path1.afterFirst(path0); if (ret.startsWith("/")) { ret = ret.substr(1); } return ret.replace('/', '.').beforeLast('.').toString(); } }
public static String sourceFileNameToClassName(File baseDir, String filePath) { if (!filePath.endsWith(".java")) { return null; } FastStr path0 = FastStr.of(baseDir.getAbsolutePath()); FastStr path1 = FastStr.of(filePath); if (File.separatorChar != '/') { path0 = path0.replace(File.separatorChar, '/'); path1 = path1.replace(File.separatorChar, '/'); } FastStr ret = path1.afterFirst(path0); if (ret.startsWith("/")) { ret = ret.substr(1); } return ret.replace('/', '.').beforeLast('.').toString(); } }
public static File sourceFile(List<File> sourceRoots, String className) { FastStr s = FastStr.of(className).beforeFirst('$'); s = s.replace('.', File.separatorChar).append(".java"); for (File sourceRoot : sourceRoots) { File file = new File(sourceRoot, s.toString()); if (file.canRead()) { return file; } } return null; }
public static String classNameToClassFileName(String className, boolean keepInnerClass) { FastStr fs = FastStr.of(className); if (!keepInnerClass && className.contains("$")) { fs = fs.beforeFirst('$'); } fs = fs.replace('.', '/').append(".class").prepend('/'); return fs.toString(); }
public static String classNameToClassFileName(String className, boolean keepInnerClass) { FastStr fs = FastStr.of(className); if (!keepInnerClass && className.contains("$")) { fs = fs.beforeFirst('$'); } fs = fs.replace('.', '/').append(".class").prepend('/'); return fs.toString(); }
protected T targetVersion(JavaVersion version) { targetVersion = FastStr.of(version.name()).substr(1).replace('_', '.').toString(); return me(); }
protected T sourceVersion(JavaVersion version) { sourceVersion = FastStr.of(version.name()).substr(1).replace('_', '.').toString(); return me(); }
protected T sourceVersion(JavaVersion version) { sourceVersion = FastStr.of(version.name()).substr(1).replace('_', '.').toString(); return me(); }
protected T targetVersion(JavaVersion version) { targetVersion = FastStr.of(version.name()).substr(1).replace('_', '.').toString(); return me(); }