public class Script extends Object
Constructor and Description |
---|
Script(Object command)
Constructor.
|
Script(String title,
Object command)
Constructor.
|
Script(String title,
Object command,
boolean isShell)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getCode()
Get the scriptable data as
String . |
InputStream |
getCodeStream()
Get the scriptable data as
InputStream . |
Object |
getCommand()
Returns the command object of this script.
|
Object |
getFile()
Returns the file instance, if the current command is backed by a file.
|
ScriptResult |
getResult()
Get execution result.
|
String |
getTitle()
Get the title of this script.
|
int |
hashCode() |
boolean |
isDynamic()
Check if this script is defined by dynamically generated code.
|
boolean |
isShellMode()
Script originated from interactive input or shell, as opposed to a source file.
|
void |
setException(Throwable e)
Set an execution exception.
|
void |
setResult(Object result)
Set the execution result.
|
String |
toString() |
public Script(String title, Object command, boolean isShell)
title
- name of script objectcommand
- command (sequence) to be executedisShell
- true
if the script originated from a shell/interactive sessionpublic Script(String title, Object command)
title
- name of script objectcommand
- command (sequence) to be executedpublic Script(Object command)
command
- command (sequence) to be executedpublic InputStream getCodeStream() throws Exception
InputStream
. The caller needs to close the stream when it is not used anymore. Calling this method multiple times will
return different streams with the same text content.Exception
- when stream cannot be establishedpublic String getCode() throws Exception
String
.Exception
- when code cannot be read from sourcepublic final Object getCommand()
public final ScriptResult getResult()
public final void setResult(Object result)
result
- execution resultpublic final void setException(Throwable e)
e
- exceptionpublic Object getFile()
public boolean isDynamic()
true
when not a file and not an URL
public String getTitle()
null
public boolean isShellMode()
true
origin is interactive input or shell, or false
if origin is a source file.