- All Superinterfaces:
AutoCloseable,Closeable,Flushable,JavaFileManager,OptionChecker
JavaFileManager that allows adding of PathRoot objects to the
manager.
This component is responsible for bridging the gap between a Workspace and
a JavaCompiler when performing a compilation, and thus includes a number of
required operations that the compiler will query the file system with. In addition, this
interface also defines a number of additional functionalities that are useful for querying and
verifying the outcome of compilations within tests.
- Since:
- 0.0.1
- Author:
- Ashley Scopes
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.tools.JavaFileManager
JavaFileManager.Location -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPath(JavaFileManager.Location location, PathRoot path) Add a package-oriented path to a given location.voidaddPaths(JavaFileManager.Location location, Collection<? extends PathRoot> paths) Add a collection of package-oriented paths to a given location.voidCopy all containers from the first location to the second location.voidcreateEmptyLocation(JavaFileManager.Location location) Register an empty container for the given location to indicate to the compiler that the feature exists, but has no configured paths.default @Nullable ModuleContainerGroupGet the location holding theannotation processor module path.default @Nullable PackageContainerGroupGet the location holding theannotation processor path.default @Nullable OutputContainerGroupGet the location holding theclass outputs.default @Nullable PackageContainerGroupGet the location holding theclass path.Get the associated effective release.Get the container group for the given module-oriented location.Get a collection of all module container groups in this file manager.default @Nullable ModuleContainerGroupGet the location holding themodule path.default @Nullable ModuleContainerGroupGet the location holding themodule source path.Get the container group for the given output-oriented location.Get a collection of all output container groups in this file manager.Get the container group for the given package-oriented location.Get a collection of all package container groups in this file manager.default @Nullable OutputContainerGroupGet the location holding thesource outputs.default @Nullable PackageContainerGroupGet the location holding thesource path.list(JavaFileManager.Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) List all file objects in the given location matching the given criteria.Methods inherited from interface javax.tools.JavaFileManager
close, contains, flush, getClassLoader, getFileForInput, getFileForOutput, getJavaFileForInput, getJavaFileForOutput, getLocationForModule, getLocationForModule, getServiceLoader, handleOption, hasLocation, inferBinaryName, inferModuleName, isSameFile, listLocationsForModulesMethods inherited from interface javax.tools.OptionChecker
isSupportedOption
-
Method Details
-
addPath
Add a package-oriented path to a given location.To add a module, first obtain the module location using
JavaFileManager.getLocationForModule(Location, String), and pass that result to this call.- Parameters:
location- the location to use.path- the path to add.- See Also:
-
addPaths
Add a collection of package-oriented paths to a given location.To add a module, first obtain the module location using
JavaFileManager.getLocationForModule(Location, String), and pass that result to this call.- Parameters:
location- the location to use.paths- the paths to add.- See Also:
-
copyContainers
Copy all containers from the first location to the second location.- Parameters:
from- the first location.to- the second location.
-
createEmptyLocation
Register an empty container for the given location to indicate to the compiler that the feature exists, but has no configured paths.This is needed to coerce the behaviour for annotation processing in some cases.
If the location already exists, then do not do anything.
If the location is an output location, then this operation does not make any sense, since an empty location cannot have files output to it. In this case, you will likely get an exception.
Likewise, this operation does not make sense for module locations within a module-oriented location group, so this operation will fail with an error for those inputs as well.
- Parameters:
location- the location to apply an empty container for.- Throws:
IllegalArgumentException- if the location is an output location or a module location.
-
getEffectiveRelease
Get the associated effective release.- Returns:
- the effective release.
- Since:
- 0.0.1
-
getPackageContainerGroup
Get the container group for the given package-oriented location.- Parameters:
location- the package oriented location.- Returns:
- the container group, or null if one does not exist.
-
getPackageContainerGroups
Get a collection of all package container groups in this file manager.- Returns:
- the package container groups.
-
getModuleContainerGroup
Get the container group for the given module-oriented location.- Parameters:
location- the module oriented location.- Returns:
- the container group, or null if one does not exist.
-
getModuleContainerGroups
Get a collection of all module container groups in this file manager.- Returns:
- the module container groups.
-
getOutputContainerGroup
Get the container group for the given output-oriented location.- Parameters:
location- the output oriented location.- Returns:
- the container group, or null if one does not exist.
-
getOutputContainerGroups
Get a collection of all output container groups in this file manager.- Returns:
- the output container groups.
-
list
Set<JavaFileObject> list(JavaFileManager.Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException List all file objects in the given location matching the given criteria.- Specified by:
listin interfaceJavaFileManager- Parameters:
location- the location to search in.packageName- the package name to search in, or""to search in the root location.kinds- the kinds of file to return, orSet.of()(JavaFileObject.Kind.OTHER)to find all files.recurse-trueto recurse into subpackages,falseto only check the current package.- Returns:
- a collection of unique file objects that were found.
- Throws:
IOException- if an IO error occurs reading the file system.
-
getClassOutputGroup
Get the location holding theclass outputs.- Returns:
- the location, or
nullif the location is not present in the file manager. - Since:
- 0.1.0
-
getSourceOutputGroup
Get the location holding thesource outputs.- Returns:
- the location, or
nullif the location is not present in the file manager. - Since:
- 0.1.0
-
getClassPathGroup
Get the location holding theclass path.- Returns:
- the location, or
nullif the location is not present in the file manager. - Since:
- 0.1.0
-
getSourcePathGroup
Get the location holding thesource path.- Returns:
- the location, or
nullif the location is not present in the file manager. - Since:
- 0.1.0
-
getAnnotationProcessorPathGroup
Get the location holding theannotation processor path.- Returns:
- the location, or
nullif the location is not present in the file manager. - Since:
- 0.1.0
-
getAnnotationProcessorModulePathGroup
Get the location holding theannotation processor module path.- Returns:
- the location, or
nullif the location is not present in the file manager. - Since:
- 0.1.0
-
getModuleSourcePathGroup
Get the location holding themodule source path.- Returns:
- the location, or
nullif the location is not present in the file manager. - Since:
- 0.1.0
-
getModulePathGroup
Get the location holding themodule path.- Returns:
- the location, or
nullif the location is not present in the file manager. - Since:
- 0.1.0
-