Package manifold.api.type
Interface ITypeManifold
-
- All Superinterfaces:
IFileConnected,ISelfCompiled
- All Known Implementing Classes:
JavaTypeManifold,ResourceFileTypeManifold,UrlTypeManifold
public interface ITypeManifold extends IFileConnected, ISelfCompiled
AITypeManifoldis a fundamental component of the Manifold API. Implementors of this interface work together to dynamically provide the Java compiler with type information as it requests it. Its primary duties include: Separate instances of a given implementation of this interface exist per- Define a domain of types via
getTypeNames(String)- Resolve types in that domain via
isType(String),isTopLevelType(String), andisPackage(String)- Contribute source toward a given type projection via
contribute(JavaFileManager.Location, String, boolean, String, DiagnosticListener)IModule.
-
-
Field Summary
Fields Modifier and Type Field Description static StringARG_DUMP_SOURCESystem property to aid in debugging generated source.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanaccept(IModule module)A module calls this method to determine whether to include this type manifold in its collection of type manifolds.voidclear()Clear all cached dataStringcontribute(JavaFileManager.Location location, String fqn, boolean genStubs, String existing, DiagnosticListener<JavaFileObject> errorHandler)Contribute source corresponding with the fqn.default voidenterPostJavaCompilation()Signals that normal javac compilation is complete with respect to the supplied Java source file list passed to javac.List<IFile>findFilesForType(String fqn)Collection<String>getAllTypeNames()ClassTypegetClassType(String fqn)What kind of type corresponds with fqn?ContributorKindgetContributorKind()How does this producer contribute toward the source file producedIModulegetModule()The module to which this producer is scopedStringgetPackage(String fqn)What is the package name for the specified fqn?ISourceKindgetSourceKind()What kind of source is produced?Collection<TypeName>getTypeNames(String namespace)voidinit(IModule module)Initialize this type manifold.booleanisPackage(String pkg)Verifies whether or not the specified package may be provided by this source producerbooleanisTopLevelType(String fqn)booleanisType(String fqn)Does this producer supply source for the specified fqn?-
Methods inherited from interface manifold.api.type.IFileConnected
getTypesForFile, handlesFile, handlesFileExtension, isFileBacked, refreshedFile
-
Methods inherited from interface manifold.api.type.ISelfCompiled
compile, isSelfCompile, parse
-
-
-
-
Field Detail
-
ARG_DUMP_SOURCE
static final String ARG_DUMP_SOURCE
System property to aid in debugging generated source.- See Also:
- Constant Field Values
-
-
Method Detail
-
accept
default boolean accept(IModule module)
A module calls this method to determine whether to include this type manifold in its collection of type manifolds. Gives this type manifold an opportunity to opt out of inclusion based on the module. For instance, if a module should only operate in a runtime environment, it should return false if the module's host is not an instance ofIRuntimeManifoldHost. Called after instantiation and, if returns true, beforeinit(IModule).- Parameters:
module- The module asking for acceptance- Returns:
trueIf this type manifold should be initialized and included in the module, otherwisefalseto be discarded.
-
init
void init(IModule module)
Initialize this type manifold. Avoid defining types in the scope of this method.- Parameters:
module- The module to which this type manifold exclusively belongs
-
getModule
IModule getModule()
The module to which this producer is scoped
-
getSourceKind
ISourceKind getSourceKind()
What kind of source is produced? Java?
-
getContributorKind
ContributorKind getContributorKind()
How does this producer contribute toward the source file produced
-
isType
boolean isType(String fqn)
Does this producer supply source for the specified fqn?
-
isTopLevelType
boolean isTopLevelType(String fqn)
-
isPackage
boolean isPackage(String pkg)
Verifies whether or not the specified package may be provided by this source producer
-
contribute
String contribute(JavaFileManager.Location location, String fqn, boolean genStubs, String existing, DiagnosticListener<JavaFileObject> errorHandler)
Contribute source corresponding with the fqn.
-
getAllTypeNames
Collection<String> getAllTypeNames()
-
getTypeNames
Collection<TypeName> getTypeNames(String namespace)
-
clear
void clear()
Clear all cached data
-
enterPostJavaCompilation
default void enterPostJavaCompilation()
Signals that normal javac compilation is complete with respect to the supplied Java source file list passed to javac. Any "other" source files passed in (via other.source.files property using -Akey=value arg) are about to be compiled. This method was added to facilitate a self-compiled type manifold such as Gosu where it can reliably depend on Java ClassSymbols to be complete from the JavacPlugin's javacTask. This in turn enables the sharing of these symbols so the type manifold doesn't have to load a second javacTask and potentially duplicate expensive work.
-
-