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, uninit
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, enterPostJavaCompilation, getClassType, getContributorKind, getSourceKind
handlesFileExtension
compile, isSelfCompile, parse
getInterface
public void init(IModule module)
ITypeManifold
init
in interface ITypeManifold
module
- 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()
IFileConnected
isFileBacked
in interface IFileConnected
protected 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 file
file
- 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 IFileConnected
file
public String[] getTypesForFile(IFile file)
IFileConnected
getTypesForFile
in interface IFileConnected
file
- The file in questionpublic IModule getModule()
ITypeManifold
getModule
in interface ITypeManifold
public RefreshKind refreshedFile(IFile file, String[] types, RefreshKind kind)
IFileConnected
refreshedFile
in interface IFileConnected
file
- The file that was refreshedkind
- @return All known types affected by the file changepublic boolean isType(String fqn)
ITypeManifold
isType
in interface ITypeManifold
public boolean isPackage(String pkg)
ITypeManifold
isPackage
in interface ITypeManifold
public String findTopLevelFqn(String fqn)
public boolean isTopLevelType(String fqn)
isTopLevelType
in interface ITypeManifold
public String getPackage(String fqn)
ITypeManifold
getPackage
in interface ITypeManifold
public String contribute(JavaFileManager.Location location, String fqn, boolean genStubs, String existing, DiagnosticListener<JavaFileObject> errorHandler)
ITypeManifold
contribute
in interface ITypeManifold
public Collection<String> getAllTypeNames()
getAllTypeNames
in interface ITypeManifold
public Collection<TypeName> getTypeNames(String namespace)
getTypeNames
in interface ITypeManifold
public List<IFile> findFilesForType(String fqn)
findFilesForType
in interface ITypeManifold
public void clear()
ITypeManifold
clear
in interface ITypeManifold
Copyright © 2024. All rights reserved.