@Override public FastStr afterFirst(String s) { return afterFirst(unsafeOf(s)); }
@Override public FastStr afterFirst(String s) { return afterFirst(unsafeOf(s)); }
@Override public Void apply(JarFile jarFile, JarEntry jarEntry) throws NotAppliedException, $.Break { try { String fileName = jarEntry.getName(); if (fileName.startsWith("conf/")) { FastStr fs = FastStr.of(fileName).afterFirst('/'); String env = ConfLoader.common(); if (fs.contains('/')) { env = fs.beforeFirst('/').intern(); } Properties p = map.get(env); if (null == p) { p = new Properties(); map.put(env, p); } InputStream is = jarFile.getInputStream(jarEntry); Properties p2 = new Properties(); p2.load(is); p.putAll(p2); } } catch (IOException e) { logger.warn(e, "Unable to load properties file from jar entry %s", jarEntry.getName()); } return null; } };
@Override public Void apply(JarFile jarFile, JarEntry jarEntry) throws NotAppliedException, $.Break { try { String fileName = jarEntry.getName(); if (fileName.startsWith("conf/")) { FastStr fs = FastStr.of(fileName).afterFirst('/'); String env = ConfLoader.common(); if (fs.contains('/')) { env = fs.beforeFirst('/').intern(); } Properties p = map.get(env); if (null == p) { p = new Properties(); map.put(env, p); } InputStream is = jarFile.getInputStream(jarEntry); Properties p2 = new Properties(); p2.load(is); p.putAll(p2); } } catch (IOException e) { logger.warn(e, "Unable to load properties file from jar entry %s", jarEntry.getName()); } 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(); } }