本文整理匯總了Java中scala.tools.nsc.util.ClassPath類的典型用法代碼示例。如果您正苦於以下問題:Java ClassPath類的具體用法?Java ClassPath怎麽用?Java ClassPath使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ClassPath類屬於scala.tools.nsc.util包,在下文中一共展示了ClassPath類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mergeUrlsIntoClassPath
import scala.tools.nsc.util.ClassPath; //導入依賴的package包/類
private MergedClassPath<AbstractFile> mergeUrlsIntoClassPath(JavaPlatform platform, URL[] urls) {
IndexedSeq<ClassPath<AbstractFile>> entries =
((MergedClassPath<AbstractFile>) platform.classPath()).entries();
List<ClassPath<AbstractFile>> cp = new LinkedList<ClassPath<AbstractFile>>();
for (int i = 0; i < entries.size(); i++) {
cp.add(entries.apply(i));
}
for (URL url : urls) {
AbstractFile file;
if ("file".equals(url.getProtocol())) {
File f = new File(url.getPath());
if (f.isDirectory()) {
file = AbstractFile.getDirectory(scala.reflect.io.File.jfile2path(f));
} else {
file = AbstractFile.getFile(scala.reflect.io.File.jfile2path(f));
}
} else {
file = AbstractFile.getURL(url);
}
ClassPath<AbstractFile> newcp = platform.classPath().context().newClassPath(file);
// distinct
if (cp.contains(newcp) == false) {
cp.add(newcp);
}
}
return new MergedClassPath(scala.collection.JavaConversions.asScalaBuffer(cp).toIndexedSeq(),
platform.classPath().context());
}
示例2: mergeUrlsIntoClassPath
import scala.tools.nsc.util.ClassPath; //導入依賴的package包/類
private MergedClassPath<AbstractFile> mergeUrlsIntoClassPath(JavaPlatform platform, URL[] urls) {
IndexedSeq<ClassPath<AbstractFile>> entries =
((MergedClassPath<AbstractFile>) platform.classPath()).entries();
List<ClassPath<AbstractFile>> cp = new LinkedList<>();
for (int i = 0; i < entries.size(); i++) {
cp.add(entries.apply(i));
}
for (URL url : urls) {
AbstractFile file;
if ("file".equals(url.getProtocol())) {
File f = new File(url.getPath());
if (f.isDirectory()) {
file = AbstractFile.getDirectory(scala.reflect.io.File.jfile2path(f));
} else {
file = AbstractFile.getFile(scala.reflect.io.File.jfile2path(f));
}
} else {
file = AbstractFile.getURL(url);
}
ClassPath<AbstractFile> newcp = platform.classPath().context().newClassPath(file);
// distinct
if (cp.contains(newcp) == false) {
cp.add(newcp);
}
}
return new MergedClassPath(scala.collection.JavaConversions.asScalaBuffer(cp).toIndexedSeq(),
platform.classPath().context());
}