class LoadFileCommand extends Command
Command that represents a request to use
Jython to run a file containing Jython statements. This is conceptually a
bit similar to importing a module, but the loading is done behind the scenes
and you may specify whatever namespace you like (be careful!).| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
name
Namespace to use when executing
path. |
private java.lang.String |
path
Path to the Jython file awaiting execution.
|
| Constructor and Description |
|---|
LoadFileCommand(Console console,
java.lang.String name,
java.lang.String path)
Creates a command that will attempt to execute a Jython file in the
namespace given by
name. |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Interpreter interpreter)
Tries to load the file specified by
path using moduleName
for the __name__ attribute. |
java.lang.String |
toString() |
getInputStreamprivate java.lang.String path
public LoadFileCommand(Console console, java.lang.String name, java.lang.String path)
name.console - Originating console.name - Namespace to use when executing path.path - Path to a Jython file.public void execute(Interpreter interpreter) throws java.lang.Exception
path using moduleName
for the __name__ attribute. Note that this command does not
currently display any results in the originating Console.
If moduleName is not __main__, this command is
basically the same thing as doing from moduleName import *.
If moduleName is __main__, then this command
will work for if __name__ == '__main__' and will run main
functions as expected.
public java.lang.String toString()
toString in class java.lang.Object