Class NodejsRequiredSourceModule
java.lang.Object
com.ibm.wala.classLoader.FileModule
com.ibm.wala.classLoader.SourceFileModule
com.ibm.wala.cast.js.nodejs.NodejsRequiredSourceModule
- All Implemented Interfaces:
Module, ModuleEntry, SourceModule
- Direct Known Subclasses:
NodejsRequiredCoreModule
This class is intended to be used whenever a JavaScript module is dynamically required by
JavaScript (CommonJS). The required file will be loaded and wrapped in a function call to
simulate the real behavior of a CommonJS environment. The resulting function will be named
GLOBAL_PREFIX + relative file-name. To retrieve the final function name, use getFunctioName().
- Author:
- Brian Pfretzschner <brian.pfretzschner@gmail.com>
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNodejsRequiredSourceModule(String className, File f, SourceFileModule clonedFrom) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertFileToClassName(File rootDir, File file) Generate a className based on the file name and path of the module file.getName()static NodejsRequiredSourceModuleMethods inherited from class SourceFileModule
getInputReader, getURL, isClassFile, isSourceFile, toStringMethods inherited from class FileModule
asModule, equals, getAbsolutePath, getContainer, getEntries, getFile, hashCode, isModuleFileMethods inherited from interface Module
getEntriesMethods inherited from interface ModuleEntry
asModule, getContainer, isModuleFile
-
Constructor Details
-
NodejsRequiredSourceModule
protected NodejsRequiredSourceModule(String className, File f, SourceFileModule clonedFrom) throws IOException - Parameters:
f- Must be a file located below folder workingDir.- Throws:
IOException
-
-
Method Details
-
getInputStream
- Specified by:
getInputStreamin interfaceModuleEntry- Overrides:
getInputStreamin classFileModule- Returns:
- an InputStream which provides the contents of this logical file.
-
getClassName
- Specified by:
getClassNamein interfaceModuleEntry- Overrides:
getClassNamein classSourceFileModule- Returns:
- the name of the class represented by this entry
-
getName
- Specified by:
getNamein interfaceModuleEntry- Overrides:
getNamein classFileModule- Returns:
- a String that represents the name of the file described by this object
-
convertFileToClassName
-
make
- Throws:
IOException
-