Package manifold.ext

Class AbstractExtensionProducer<M extends manifold.api.type.IModel>

  • All Implemented Interfaces:
    manifold.api.service.IPluginHost, manifold.api.service.IService, manifold.api.type.IFileConnected, manifold.api.type.ISelfCompiled, manifold.api.type.ITypeManifold, IExtensionClassProducer

    public abstract class AbstractExtensionProducer<M extends manifold.api.type.IModel>
    extends manifold.api.type.JavaTypeManifold<M>
    implements IExtensionClassProducer
    An abstraction for a type manifold that produces Extension Classes to be processed by the ExtensionManifold. See ExtensionProducerSampleTypeManifold as a reference implementation.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class manifold.api.type.ResourceFileTypeManifold

        manifold.api.type.ResourceFileTypeManifold.CacheClearer
    • Field Summary

      • Fields inherited from interface manifold.api.type.ITypeManifold

        ARG_DUMP_SOURCE
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected manifold.api.type.ResourceFileTypeManifold.CacheClearer createCacheClearer()  
      protected abstract M createModel​(String extensionClassName, Set<manifold.api.fs.IFile> files)  
      protected abstract String deriveExtendedClassFrom​(String extensionClassFqn)  
      String findTopLevelFqn​(String fqn)
      Overridden because the file's fqn isn't really a type for this type manifold, only the extension classes derived from the files are types this manifold produces.
      Set<String> getExtendedTypes()
      The set of extension classes this type manifold produces.
      protected abstract Set<String> getExtendedTypes​(manifold.api.fs.IFile file)  
      Set<String> getExtendedTypesForFile​(manifold.api.fs.IFile file)
      The set of classes extended via {$code file}.
      Set<String> getExtensionClasses​(String extendedType)
      The subset of extension classes this type manifold produces that extend fqn
      protected abstract String getFileExt()  
      protected Map<String,​manifold.util.concurrent.LocklessLazyVar<M>> getPeripheralTypes()  
      String getTypeNameForFile​(String defaultFqn, manifold.api.fs.IFile file)
      The type name[s] produced from a file from an extension producer are the names of the extension classes
      String[] getTypesForFile​(manifold.api.fs.IFile file)  
      boolean handlesFileExtension​(String fileExtension)  
      void init​(manifold.api.host.IModule moduleComponent)  
      boolean isExtendedType​(String fqn)
      Does this type manifold produce extension class[es] for fqn?
      boolean isInnerType​(String topLevelFqn, String relativeInner)  
      protected abstract String makeExtensionClassName​(String extendedClassFqn)  
      manifold.api.host.RefreshKind refreshedFile​(manifold.api.fs.IFile file, String[] types, manifold.api.host.RefreshKind kind)  
      • Methods inherited from class manifold.api.type.JavaTypeManifold

        getClassType, getContributorKind, getSourceKind
      • Methods inherited from class manifold.api.type.ResourceFileTypeManifold

        clear, contribute, contribute, findFilesForType, getAdditionalTypes, getAllTypeNames, getContent, getModel, getModule, getPackage, getTypeNames, handlesFile, init, isDuplicate, isFileBacked, isPackage, isTopLevelType, isType
      • Methods inherited from class manifold.api.service.BaseService

        doInit, doUninit, init, isInited, uninit
      • Methods inherited from interface manifold.api.type.IFileConnected

        handlesFile, isFileBacked
      • Methods inherited from interface manifold.api.service.IPluginHost

        getInterface
      • Methods inherited from interface manifold.api.type.ISelfCompiled

        compile, isSelfCompile, parse
      • Methods inherited from interface manifold.api.type.ITypeManifold

        accept, clear, contribute, enterPostJavaCompilation, findFilesForType, getAllTypeNames, getClassType, getContributorKind, getModule, getPackage, getSourceKind, getTypeNames, isPackage, isTopLevelType, isType
    • Constructor Detail

      • AbstractExtensionProducer

        public AbstractExtensionProducer()
    • Method Detail

      • init

        public void init​(manifold.api.host.IModule moduleComponent)
        Specified by:
        init in interface manifold.api.type.ITypeManifold
        Overrides:
        init in class manifold.api.type.ResourceFileTypeManifold<M extends manifold.api.type.IModel>
      • getFileExt

        protected abstract String getFileExt()
        Returns:
        The file extension of the resource files this type manifold processes
      • createModel

        protected abstract M createModel​(String extensionClassName,
                                         Set<manifold.api.fs.IFile> files)
        Returns:
        A new model for the qualified extensionClassName using files
      • makeExtensionClassName

        protected abstract String makeExtensionClassName​(String extendedClassFqn)
        Returns:
        The qualified extension class name corresponding with extendedClassFqn
      • deriveExtendedClassFrom

        protected abstract String deriveExtendedClassFrom​(String extensionClassFqn)
        Returns:
        The qualified extended class name derived from extendedClassFqn
      • getTypeNameForFile

        public String getTypeNameForFile​(String defaultFqn,
                                         manifold.api.fs.IFile file)
        The type name[s] produced from a file from an extension producer are the names of the extension classes
        Overrides:
        getTypeNameForFile in class manifold.api.type.ResourceFileTypeManifold<M extends manifold.api.type.IModel>
      • findTopLevelFqn

        public String findTopLevelFqn​(String fqn)
        Overridden because the file's fqn isn't really a type for this type manifold, only the extension classes derived from the files are types this manifold produces.
        Overrides:
        findTopLevelFqn in class manifold.api.type.ResourceFileTypeManifold<M extends manifold.api.type.IModel>
      • createCacheClearer

        protected manifold.api.type.ResourceFileTypeManifold.CacheClearer createCacheClearer()
        Overrides:
        createCacheClearer in class manifold.api.type.ResourceFileTypeManifold<M extends manifold.api.type.IModel>
      • refreshedFile

        public manifold.api.host.RefreshKind refreshedFile​(manifold.api.fs.IFile file,
                                                           String[] types,
                                                           manifold.api.host.RefreshKind kind)
        Specified by:
        refreshedFile in interface manifold.api.type.IFileConnected
        Overrides:
        refreshedFile in class manifold.api.type.ResourceFileTypeManifold<M extends manifold.api.type.IModel>
      • handlesFileExtension

        public boolean handlesFileExtension​(String fileExtension)
        Specified by:
        handlesFileExtension in interface manifold.api.type.IFileConnected
      • getPeripheralTypes

        protected Map<String,​manifold.util.concurrent.LocklessLazyVar<M>> getPeripheralTypes()
        Overrides:
        getPeripheralTypes in class manifold.api.type.ResourceFileTypeManifold<M extends manifold.api.type.IModel>
      • isInnerType

        public boolean isInnerType​(String topLevelFqn,
                                   String relativeInner)
        Specified by:
        isInnerType in class manifold.api.type.ResourceFileTypeManifold<M extends manifold.api.type.IModel>
      • isExtendedType

        public boolean isExtendedType​(String fqn)
        Description copied from interface: IExtensionClassProducer
        Does this type manifold produce extension class[es] for fqn?
        Specified by:
        isExtendedType in interface IExtensionClassProducer
        Parameters:
        fqn - The fully qualified name of a type for which this manifold may produce an extension class
        Returns:
        True if this manifold produces extension class[es] for fqn
      • getExtensionClasses

        public Set<String> getExtensionClasses​(String extendedType)
        Description copied from interface: IExtensionClassProducer
        The subset of extension classes this type manifold produces that extend fqn
        Specified by:
        getExtensionClasses in interface IExtensionClassProducer
        Parameters:
        extendedType - The fully qualified name of a potentially extended type
        Returns:
        The subset of extension classes this type manifold produces that extend fqn
      • getTypesForFile

        public String[] getTypesForFile​(manifold.api.fs.IFile file)
        Specified by:
        getTypesForFile in interface manifold.api.type.IFileConnected
        Overrides:
        getTypesForFile in class manifold.api.type.ResourceFileTypeManifold<M extends manifold.api.type.IModel>
      • getExtendedTypes

        protected abstract Set<String> getExtendedTypes​(manifold.api.fs.IFile file)