当前位置: 首页>>代码示例>>Java>>正文


Java Location.isOutputLocation方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:T6397104.java

示例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);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:39,代码来源:JavacFiler.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:Locations.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Locations.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:Locations.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:Locations.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:Locations.java

示例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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:ModuleAndPackageLocations.java


注:本文中的javax.tools.JavaFileManager.Location.isOutputLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。