public class Script
extends java.lang.Object
Constructor and Description |
---|
Script(java.lang.Object command)
Constructor.
|
Script(java.lang.String title,
java.lang.Object command)
Constructor.
|
Script(java.lang.String title,
java.lang.Object command,
boolean isShell)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getCode()
Get the scriptable data as
String . |
java.io.InputStream |
getCodeStream()
Get the scriptable data as
InputStream . |
java.lang.Object |
getCommand()
Returns the command object of this script.
|
java.lang.Object |
getFile()
Returns the file instance, if the current command is backed by a file.
|
ScriptResult |
getResult()
Get execution result.
|
java.lang.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(java.lang.Throwable e)
Set an execution exception.
|
void |
setResult(java.lang.Object result)
Set the execution result.
|
java.lang.String |
toString() |
public Script(java.lang.String title, java.lang.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(java.lang.String title, java.lang.Object command)
title
- name of script objectcommand
- command (sequence) to be executedpublic Script(java.lang.Object command)
command
- command (sequence) to be executedpublic java.io.InputStream getCodeStream() throws java.lang.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.java.lang.Exception
- when stream cannot be establishedpublic java.lang.String getCode() throws java.lang.Exception
String
.java.lang.Exception
- when code cannot be read from sourcepublic final java.lang.Object getCommand()
public final ScriptResult getResult()
public final void setResult(java.lang.Object result)
result
- execution resultpublic final void setException(java.lang.Throwable e)
e
- exceptionpublic java.lang.Object getFile()
IFile
, File
or null
public boolean isDynamic()
true
when not a file and not an URL
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getTitle()
null
public boolean isShellMode()
true
origin is interactive input or shell, or false
if origin is a source file.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object