本文整理汇总了Java中javax.tools.StandardLocation.PLATFORM_CLASS_PATH属性的典型用法代码示例。如果您正苦于以下问题:Java StandardLocation.PLATFORM_CLASS_PATH属性的具体用法?Java StandardLocation.PLATFORM_CLASS_PATH怎么用?Java StandardLocation.PLATFORM_CLASS_PATH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.tools.StandardLocation
的用法示例。
在下文中一共展示了StandardLocation.PLATFORM_CLASS_PATH属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: list
@Override
public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException {
if (location != StandardLocation.PLATFORM_CLASS_PATH || !kinds.contains(Kind.CLASS))
return Collections.emptyList();
if (!packageName.isEmpty())
packageName += ".";
List<JavaFileObject> result = new ArrayList<>();
for (Entry<String, JavaFileObject> e : className2File.entrySet()) {
String currentPackage = e.getKey().substring(0, e.getKey().lastIndexOf(".") + 1);
if (recurse ? currentPackage.startsWith(packageName) : packageName.equals(currentPackage))
result.add(e.getValue());
}
return result;
}
示例2: testBasic
@Test
public void testBasic(Path base) throws IOException {
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
Location[] locns = {
StandardLocation.SOURCE_PATH,
StandardLocation.CLASS_PATH,
StandardLocation.PLATFORM_CLASS_PATH,
};
// set a value
Path out = Files.createDirectories(base.resolve("out"));
for (Location locn : locns) {
checkException("unsupported for location",
IllegalArgumentException.class,
"location is not an output location or a module-oriented location: " + locn,
() -> fm.setLocationForModule(locn, "m", List.of(out)));
}
}
}
示例3: getLocation
@Override
public Iterable<? extends File> getLocation(Location location) {
org.openide.filesystems.FileObject[] roots;
ClassPath cp = null;
if (location == StandardLocation.SOURCE_PATH) {
cp = cpInfo.getClassPath(ClasspathInfo.PathKind.SOURCE);
} else if (location == StandardLocation.CLASS_PATH) {
cp = cpInfo.getClassPath(ClasspathInfo.PathKind.COMPILE);
} else if (location == StandardLocation.PLATFORM_CLASS_PATH) {
cp = cpInfo.getClassPath(ClasspathInfo.PathKind.BOOT);
}
if (cp == null) {
return null;
}
roots = cp.getRoots();
if (roots == null || roots.length == 0) {
return null;
}
List<File> res = new ArrayList<>(roots.length);
for (org.openide.filesystems.FileObject f : roots) {
File x = FileUtil.toFile(f);
if (x != null) {
res.add(x);
}
}
return res;
}
示例4: BootClassPathLocationHandler
BootClassPathLocationHandler() {
super(StandardLocation.PLATFORM_CLASS_PATH,
Option.BOOTCLASSPATH, Option.XBOOTCLASSPATH,
Option.XBOOTCLASSPATH_PREPEND,
Option.XBOOTCLASSPATH_APPEND,
Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
Option.EXTDIRS, Option.DJAVA_EXT_DIRS);
}
示例5: BootClassPathLocationHandler
BootClassPathLocationHandler() {
super(StandardLocation.PLATFORM_CLASS_PATH,
Option.BOOT_CLASS_PATH, Option.XBOOTCLASSPATH,
Option.XBOOTCLASSPATH_PREPEND,
Option.XBOOTCLASSPATH_APPEND,
Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
Option.EXTDIRS, Option.DJAVA_EXT_DIRS);
}
示例6: getJavaFileForInput
@Override
public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException {
if (location != StandardLocation.PLATFORM_CLASS_PATH || kind != Kind.CLASS)
return null;
return className2File.get(className);
}
示例7: hasLocation
@Override
public boolean hasLocation(Location location) {
return location == StandardLocation.CLASS_PATH || location == StandardLocation.PLATFORM_CLASS_PATH;
}
示例8: hasLocation
@Override
public boolean hasLocation(Location location) {
return location == StandardLocation.PLATFORM_CLASS_PATH;
}