M - The model you derive backing contributions of source code.public abstract class ResourceFileTypeManifold<M extends IModel> extends BaseService implements ITypeManifold
| Modifier and Type | Class and Description |
|---|---|
protected class |
ResourceFileTypeManifold.CacheClearer |
ARG_DUMP_SOURCE| Constructor and Description |
|---|
ResourceFileTypeManifold() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all cached data
|
String |
contribute(JavaFileManager.Location location,
String fqn,
boolean genStubs,
String existing,
DiagnosticListener<JavaFileObject> errorHandler)
Contribute source corresponding with the fqn.
|
protected abstract String |
contribute(JavaFileManager.Location location,
String topLevelFqn,
boolean genStubs,
String existing,
M model,
DiagnosticListener<JavaFileObject> errorHandler)
Contribute source code for the specified type and model.
|
protected ResourceFileTypeManifold.CacheClearer |
createCacheClearer() |
List<IFile> |
findFilesForType(String fqn) |
String |
findTopLevelFqn(String fqn)
This method avoids initializing all the files
|
protected Set<String> |
getAdditionalTypes(String fqnForFile,
IFile file)
Additional types derived from
file. |
Collection<String> |
getAllTypeNames() |
static String |
getContent(IFile file) |
protected M |
getModel(String topLevel) |
IModule |
getModule()
The module to which this producer is scoped
|
String |
getPackage(String fqn)
What is the package name for the specified fqn?
|
protected Map<String,manifold.util.concurrent.LocklessLazyVar<M>> |
getPeripheralTypes()
A map of name-to-model peripheral to the main map of name-to-model,
possibly including types that are not file-based.
|
String |
getTypeNameForFile(String defaultFqn,
IFile file)
Provide the type name that corresponds with the resource file, if different from
defaultFqn. |
Collection<TypeName> |
getTypeNames(String namespace) |
String[] |
getTypesForFile(IFile file)
Returns ALL type names associated with the given file
whether or not the types have been loaded yet.
|
boolean |
handlesFile(IFile file) |
void |
init(IModule module)
Initialize this type manifold.
|
protected void |
init(IModule module,
BiFunction<String,Set<IFile>,M> modelMapper) |
protected boolean |
isDuplicate(IFile file,
Set<IFile> files) |
boolean |
isFileBacked()
Are the types produced from this type manifold backed by project files such as resource files?
|
abstract boolean |
isInnerType(String topLevelFqn,
String relativeInner) |
boolean |
isPackage(String pkg)
Verifies whether or not the specified package may be provided by this source producer
|
boolean |
isTopLevelType(String fqn) |
boolean |
isType(String fqn)
Does this producer supply source for the specified fqn?
|
RefreshKind |
refreshedFile(IFile file,
String[] types,
RefreshKind kind)
Notifies that a file has been refreshed.
|
doInit, doUninit, init, isInited, uninitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccept, enterPostJavaCompilation, getClassType, getContributorKind, getSourceKindhandlesFileExtensioncompile, isSelfCompile, parsegetInterfacepublic void init(IModule module)
ITypeManifoldinit in interface ITypeManifoldmodule - The module to which this type manifold exclusively belongsprotected void init(IModule module, BiFunction<String,Set<IFile>,M> modelMapper)
module - The module passed into the {@code ITypeManifold) implementation constructormodelMapper - A function to provide a model given a qualified name and resource filepublic boolean isFileBacked()
IFileConnectedisFileBacked in interface IFileConnectedprotected ResourceFileTypeManifold.CacheClearer createCacheClearer()
protected Map<String,manifold.util.concurrent.LocklessLazyVar<M>> getPeripheralTypes()
public String getTypeNameForFile(String defaultFqn, IFile file)
defaultFqn.defaultFqn - The default name derived from the resource file name.file - The resource file corresponding with the type name.null if there is no primary type for file
but there may be additional types via getAdditionalTypes(String, IFile)protected Set<String> getAdditionalTypes(String fqnForFile, IFile file)
file.
These can be supporting classes, interfaces, extension classes, what have you.
In the case of extension classes, this type manifold must implement IExtensionClassProducer.fqnForFile - The primary type this type manifold assigned to filefile - The resource file from which types may be derivedpublic abstract boolean isInnerType(String topLevelFqn, String relativeInner)
topLevelFqn - Qualified name of top-level typerelativeInner - Top-level relative name of inner classprotected abstract String contribute(JavaFileManager.Location location, String topLevelFqn, boolean genStubs, String existing, M model, DiagnosticListener<JavaFileObject> errorHandler)
location - (Experimental) The location of the use-site in the Java compiler. Provides javac module context. Optional and only relevant at compile-time when executed within a Javac compiler.topLevelFqn - The qualified name of the top-level type to contribute.genStubs - existing - The source produced from other manifolds so far; if not empty, this manifold must not be a ContributorKind.Primary contributor.model - The model your manifold uses to generate the source.public boolean handlesFile(IFile file)
handlesFile in interface IFileConnectedfilepublic String[] getTypesForFile(IFile file)
IFileConnectedgetTypesForFile in interface IFileConnectedfile - The file in questionpublic IModule getModule()
ITypeManifoldgetModule in interface ITypeManifoldpublic RefreshKind refreshedFile(IFile file, String[] types, RefreshKind kind)
IFileConnectedrefreshedFile in interface IFileConnectedfile - The file that was refreshedkind - @return All known types affected by the file changepublic boolean isType(String fqn)
ITypeManifoldisType in interface ITypeManifoldpublic boolean isPackage(String pkg)
ITypeManifoldisPackage in interface ITypeManifoldpublic String findTopLevelFqn(String fqn)
public boolean isTopLevelType(String fqn)
isTopLevelType in interface ITypeManifoldpublic String getPackage(String fqn)
ITypeManifoldgetPackage in interface ITypeManifoldpublic String contribute(JavaFileManager.Location location, String fqn, boolean genStubs, String existing, DiagnosticListener<JavaFileObject> errorHandler)
ITypeManifoldcontribute in interface ITypeManifoldpublic Collection<String> getAllTypeNames()
getAllTypeNames in interface ITypeManifoldpublic Collection<TypeName> getTypeNames(String namespace)
getTypeNames in interface ITypeManifoldpublic List<IFile> findFilesForType(String fqn)
findFilesForType in interface ITypeManifoldpublic void clear()
ITypeManifoldclear in interface ITypeManifoldCopyright © 2024. All rights reserved.