本文整理汇总了Java中javax.tools.JavaFileManager.Location.isOutputLocation方法的典型用法代码示例。如果您正苦于以下问题:Java Location.isOutputLocation方法的具体用法?Java Location.isOutputLocation怎么用?Java Location.isOutputLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.tools.JavaFileManager.Location
的用法示例。
在下文中一共展示了Location.isOutputLocation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import javax.tools.JavaFileManager.Location; //导入方法依赖的package包/类
void test(boolean hasLocation, File siblingFile, String relName, String expectedPath)
throws Exception
{
System.err.format("test: hasLocation:%s, siblingFile:%s, relName:%s, expectedPath:%s%n",
hasLocation, siblingFile, relName, expectedPath);
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
if (hasLocation) {
for (Location location : StandardLocation.values()) {
System.err.format(" location:%s, moduleLocn:%b%n",
location, location.isModuleOrientedLocation());
if (!location.isOutputLocation()) {
continue;
}
fm.setLocation(location, Arrays.asList(new File(".")));
test(fm, location, siblingFile, relName, expectedPath);
}
} else {
test(fm, CLASS_OUTPUT, siblingFile, relName, expectedPath);
}
}
}
示例2: getResource
import javax.tools.JavaFileManager.Location; //导入方法依赖的package包/类
public FileObject getResource(Location location,
CharSequence pkg,
CharSequence relativeName) throws IOException {
String strPkg = pkg.toString();
if (strPkg.length() > 0)
checkName(strPkg);
// TODO: Only support reading resources in selected output
// locations? Only allow reading of non-source, non-class
// files from the supported input locations?
// In the following, getFileForInput is the "obvious" method
// to use, but it does not have the "obvious" semantics for
// SOURCE_OUTPUT and CLASS_OUTPUT. Conversely, getFileForOutput
// does not have the correct semantics for any "path" location
// with more than one component. So, for now, we use a hybrid
// invocation.
FileObject fileObject;
if (location.isOutputLocation()) {
fileObject = fileManager.getFileForOutput(location,
pkg.toString(),
relativeName.toString(),
null);
} else {
fileObject = fileManager.getFileForInput(location,
pkg.toString(),
relativeName.toString());
}
if (fileObject == null) {
String name = (pkg.length() == 0)
? relativeName.toString() : (pkg + "/" + relativeName);
throw new FileNotFoundException(name);
}
// If the path was already opened for writing, throw an exception.
checkFileReopening(fileObject, false);
return new FilerInputFileObject(fileObject);
}
示例3: setLocation
import javax.tools.JavaFileManager.Location; //导入方法依赖的package包/类
void setLocation(Location location, Iterable<? extends File> files) throws IOException {
LocationHandler h = getHandler(location);
if (h == null) {
if (location.isOutputLocation())
h = new OutputLocationHandler(location);
else
h = new SimpleLocationHandler(location);
handlersForLocation.put(location, h);
}
h.setLocation(files);
}
示例4: getOutputLocation
import javax.tools.JavaFileManager.Location; //导入方法依赖的package包/类
Path getOutputLocation(Location location) {
if (!location.isOutputLocation()) {
throw new IllegalArgumentException();
}
LocationHandler h = getHandler(location);
return ((OutputLocationHandler) h).outputDir;
}
示例5: setLocation
import javax.tools.JavaFileManager.Location; //导入方法依赖的package包/类
void setLocation(Location location, Iterable<? extends Path> files) throws IOException {
LocationHandler h = getHandler(location);
if (h == null) {
if (location.isOutputLocation()) {
h = new OutputLocationHandler(location);
} else {
h = new SimpleLocationHandler(location);
}
handlersForLocation.put(location, h);
}
h.setPaths(files);
}
示例6: setLocationForModule
import javax.tools.JavaFileManager.Location; //导入方法依赖的package包/类
void setLocationForModule(Location location, String moduleName,
Iterable<? extends Path> files) throws IOException {
LocationHandler h = getHandler(location);
if (h == null) {
if (location.isOutputLocation()) {
h = new OutputLocationHandler(location);
} else {
h = new ModulePathLocationHandler(location);
}
handlersForLocation.put(location, h);
}
h.setPathsForModule(moduleName, files);
}
示例7: getOutputLocation
import javax.tools.JavaFileManager.Location; //导入方法依赖的package包/类
File getOutputLocation(Location location) {
if (!location.isOutputLocation())
throw new IllegalArgumentException();
LocationHandler h = getHandler(location);
return ((OutputLocationHandler) h).outputDir;
}
示例8: toString
import javax.tools.JavaFileManager.Location; //导入方法依赖的package包/类
private static String toString(Location l) {
return l.getName().replaceAll("\\[([0-9])\\.[0-9]:", "[$1.X,") + ":" +
l.isModuleOrientedLocation() + ":" + l.isOutputLocation();
}