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
ModifierConstructorDescriptionprotected
NodejsRequiredSourceModule
(String className, File f, SourceFileModule clonedFrom) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
convertFileToClassName
(File rootDir, File file) Generate a className based on the file name and path of the module file.getName()
static NodejsRequiredSourceModule
Methods inherited from class com.ibm.wala.classLoader.SourceFileModule
getInputReader, getURL, isClassFile, isSourceFile, toString
Methods inherited from class com.ibm.wala.classLoader.FileModule
asModule, equals, getAbsolutePath, getContainer, getEntries, getFile, hashCode, isModuleFile
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.ibm.wala.classLoader.Module
getEntries
Methods inherited from interface com.ibm.wala.classLoader.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:
getInputStream
in interfaceModuleEntry
- Overrides:
getInputStream
in classFileModule
- Returns:
- an InputStream which provides the contents of this logical file.
-
getClassName
- Specified by:
getClassName
in interfaceModuleEntry
- Overrides:
getClassName
in classSourceFileModule
- Returns:
- the name of the class represented by this entry
-
getName
- Specified by:
getName
in interfaceModuleEntry
- Overrides:
getName
in classFileModule
- Returns:
- a String that represents the name of the file described by this object
-
convertFileToClassName
-
make
- Throws:
IOException
-