本文整理汇总了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());
}