Interface OutputContainerGroup
- All Superinterfaces:
AutoCloseable
,Closeable
,ContainerGroup
,ModuleContainerGroup
,PackageContainerGroup
These can behave as if they are module-oriented, or non-module-oriented. It is down to the implementation to mediate access between modules and their files.
Operations on modules should first get
or
create
the module, and then operate on that sub-container
group. Operations on non-module packages should operate on this container group directly.
Note that each container group will usually only support one package container group in the outputs. This is due to the JSR-199 API not providing a method for specifying which output location to write files to for legacy-style packages.
- Since:
- 0.0.1
- Author:
- Ashley Scopes
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPackage
(Container container) Add a container to this group.void
addPackage
(PathRoot path) Add a path to this group.Get the output-oriented location.Get the package containers in this group.Methods inherited from interface io.github.ascopes.jct.containers.ContainerGroup
contains, getRelease, getServiceLoader
Methods inherited from interface io.github.ascopes.jct.containers.ModuleContainerGroup
addModule, addModule, getLocationsForModules, getModule, getModules, getOrCreateModule, hasLocation
Methods inherited from interface io.github.ascopes.jct.containers.PackageContainerGroup
getClassLoader, getFile, getFileForInput, getFileForOutput, getJavaFileForInput, getJavaFileForOutput, inferBinaryName, isEmpty, listAllFiles, listFileObjects
-
Method Details
-
addPackage
Add a path to this group.Note that this will destroy the
class loader
if one is already allocated from a previous request.If the path points to some form of archive (such as a JAR), then this may open that archive in a new resource internally. If this occurs, then the resource will always be freed by this class by calling
Closeable.close()
.Any other closable resources passed to this function will not be closed by this implementation. You must handle the lifecycle of those objects yourself.
Note that this implementation will only ever allow a single container in the package container groups. If a container is already present, then an exception will be thrown.
- Specified by:
addPackage
in interfacePackageContainerGroup
- Parameters:
path
- the path to add.- Throws:
IllegalStateException
- if a package already exists in this location.
-
addPackage
Add a container to this group.The provided container will be closed when this group is closed.
Note that this will destroy the
class loader
if one is already allocated from a previous request.Note that this implementation will only ever allow a single container in the package container groups. If a container is already present, then an exception will be thrown.
- Specified by:
addPackage
in interfacePackageContainerGroup
- Parameters:
container
- the container to add.- Throws:
IllegalStateException
- if a package already exists in this location.
-
getLocation
Get the output-oriented location.- Specified by:
getLocation
in interfaceContainerGroup
- Specified by:
getLocation
in interfaceModuleContainerGroup
- Specified by:
getLocation
in interfacePackageContainerGroup
- Returns:
- the output-oriented location.
-
getPackages
Get the package containers in this group.Returned packages are presented in the order that they were registered. This is the resolution order that the compiler will use.
Note that this implementation will only ever return one container in the list due to JSR-199 limitations.
- Specified by:
getPackages
in interfacePackageContainerGroup
- Returns:
- the list containing the package container, if it exists. Otherwise, an empty list is returned instead.
-