Class ResourceFileTypeManifold<M extends IModel>
java.lang.Object
manifold.api.service.BaseService
manifold.api.type.ResourceFileTypeManifold<M>
- Type Parameters:
M- The model you derive backing contributions of source code.
- All Implemented Interfaces:
IPluginHost, IService, IFileConnected, ISelfCompiled, ITypeManifold
- Direct Known Subclasses:
JavaTypeManifold
public abstract class ResourceFileTypeManifold<M extends IModel>
extends BaseService
implements ITypeManifold
A base class for a type manifold that is based on a resource file type, typically discernible by the file extension.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface ITypeManifold
ARG_DUMP_SOURCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all cached datacontribute(JavaFileManager.Location location, String fqn, boolean genStubs, String existing, DiagnosticListener<JavaFileObject> errorHandler) Contribute source corresponding with the fqn.protected abstract Stringcontribute(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<M>.CacheClearerfindFilesForType(String fqn) findTopLevelFqn(String fqn) This method avoids initializing all the filesgetAdditionalTypes(String fqnForFile, IFile file) Additional types derived fromfile.static StringgetContent(IFile file) protected MThe module to which this producer is scopedgetPackage(String fqn) What is the package name for the specified fqn?A map of name-to-model peripheral to the main map of name-to-model, possibly including types that are not file-based.getTypeNameForFile(String defaultFqn, IFile file) Provide the type name that corresponds with the resource file, if different fromdefaultFqn.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.booleanhandlesFile(IFile file) voidInitialize this type manifold.protected voidprotected booleanisDuplicate(IFile file, Set<IFile> files) booleanAre the types produced from this type manifold backed by project files such as resource files?abstract booleanisInnerType(String topLevelFqn, String relativeInner) booleanVerifies whether or not the specified package may be provided by this source producerbooleanisTopLevelType(String fqn) booleanDoes this producer supply source for the specified fqn?refreshedFile(IFile file, String[] types, RefreshKind kind) Notifies that a file has been refreshed.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IFileConnected
handlesFileExtensionMethods inherited from interface IPluginHost
getInterfaceMethods inherited from interface ISelfCompiled
compile, isSelfCompile, parseMethods inherited from interface ITypeManifold
accept, enterPostJavaCompilation, getClassType, getContributorKind, getSourceKind
-
Constructor Details
-
ResourceFileTypeManifold
public ResourceFileTypeManifold()
-
-
Method Details
-
init
Description copied from interface:ITypeManifoldInitialize this type manifold. Avoid defining types in the scope of this method.- Specified by:
initin interfaceITypeManifold- Parameters:
module- The module to which this type manifold exclusively belongs
-
init
-
isFileBacked
public boolean isFileBacked()Description copied from interface:IFileConnectedAre the types produced from this type manifold backed by project files such as resource files?- Specified by:
isFileBackedin interfaceIFileConnected
-
createCacheClearer
-
isDuplicate
-
getPeripheralTypes
-
getTypeNameForFile
Provide the type name that corresponds with the resource file, if different fromdefaultFqn.- Parameters:
defaultFqn- The default name derived from the resource file name.file- The resource file corresponding with the type name.- Returns:
- A valid type name corresponding with the type or
nullif there is no primary type forfilebut there may be additional types viagetAdditionalTypes(String, IFile)
-
getAdditionalTypes
Additional types derived fromfile. These can be supporting classes, interfaces, extension classes, what have you. In the case of extension classes, this type manifold must implement IExtensionClassProducer.- Parameters:
fqnForFile- The primary type this type manifold assigned tofilefile- The resource file from which types may be derived
-
isInnerType
-
contribute
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.- Parameters:
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 aContributorKind.Primarycontributor.model- The model your manifold uses to generate the source.- Returns:
- The combined source code for the specified top-level type.
-
getModel
-
handlesFile
- Specified by:
handlesFilein interfaceIFileConnected- Returns:
- True if the type manifold handles the given
file
-
getTypesForFile
Description copied from interface:IFileConnectedReturns ALL type names associated with the given file whether or not the types have been loaded yet. Type loading should NOT be used in the implementation of this method.- Specified by:
getTypesForFilein interfaceIFileConnected- Parameters:
file- The file in question- Returns:
- All known types derived from that file
-
getModule
Description copied from interface:ITypeManifoldThe module to which this producer is scoped- Specified by:
getModulein interfaceITypeManifold
-
refreshedFile
Description copied from interface:IFileConnectedNotifies that a file has been refreshed. The implementor should return all types that it knows need to be refreshed based on the given file.- Specified by:
refreshedFilein interfaceIFileConnected- Parameters:
file- The file that was refreshedkind- @return All known types affected by the file change
-
isType
Description copied from interface:ITypeManifoldDoes this producer supply source for the specified fqn?- Specified by:
isTypein interfaceITypeManifold
-
isPackage
Description copied from interface:ITypeManifoldVerifies whether or not the specified package may be provided by this source producer- Specified by:
isPackagein interfaceITypeManifold
-
findTopLevelFqn
-
isTopLevelType
- Specified by:
isTopLevelTypein interfaceITypeManifold
-
getPackage
Description copied from interface:ITypeManifoldWhat is the package name for the specified fqn?- Specified by:
getPackagein interfaceITypeManifold
-
contribute
public String contribute(JavaFileManager.Location location, String fqn, boolean genStubs, String existing, DiagnosticListener<JavaFileObject> errorHandler) Description copied from interface:ITypeManifoldContribute source corresponding with the fqn.- Specified by:
contributein interfaceITypeManifold
-
getAllTypeNames
- Specified by:
getAllTypeNamesin interfaceITypeManifold
-
getTypeNames
- Specified by:
getTypeNamesin interfaceITypeManifold
-
findFilesForType
- Specified by:
findFilesForTypein interfaceITypeManifold
-
clear
public void clear()Description copied from interface:ITypeManifoldClear all cached data- Specified by:
clearin interfaceITypeManifold
-
getContent
-