public class CompilationUnitArchive extends Object implements Serializable
CachedCompilationUnit
s
that make up a module.
Intended to work with other CompilationUnitArchives on the class path to
allow a project to be compiled incrementally. Therefore, one file may not
contain all dependent compilation units. To get all dependent compilation
units, the program will need to load all archives, plus any files not
contained in any archive.
No mater how the archive is created, when serialized, the output file
should be deterministic.Constructor and Description |
---|
CompilationUnitArchive(String topModuleName)
Create an archive object.
|
Modifier and Type | Method and Description |
---|---|
void |
addUnit(CompilationUnit unit)
Add a compilation unit to the archive.
|
static CompilationUnitArchive |
createFromFile(File location) |
static CompilationUnitArchive |
createFromStream(InputStream stream) |
static CompilationUnitArchive |
createFromURL(URL location) |
CachedCompilationUnit |
findUnit(String resourcePath) |
String |
getTopModuleName()
The name of the module used to compile this archive.
|
Map<String,CachedCompilationUnit> |
getUnits()
Retrieve all units stored in this archive.
|
void |
writeToFile(File location)
Persists the units currently stored in the archive to the specified file.
|
public CompilationUnitArchive(String topModuleName)
writeToFile(File)
method is invoked.topModuleName
- The name of the module used to compile this archive.
That is, the original parameter passed to
CompileModule
.public static CompilationUnitArchive createFromFile(File location) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static CompilationUnitArchive createFromStream(InputStream stream) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static CompilationUnitArchive createFromURL(URL location) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public void addUnit(CompilationUnit unit)
public CachedCompilationUnit findUnit(String resourcePath)
public String getTopModuleName()
public Map<String,CachedCompilationUnit> getUnits()
public void writeToFile(File location) throws IOException
IOException
Copyright © 2018. All rights reserved.