com.sun.slamd.scripting.engine
Class MethodCallInstruction

java.lang.Object
  extended bycom.sun.slamd.scripting.engine.Instruction
      extended bycom.sun.slamd.scripting.engine.MethodCallInstruction
All Implemented Interfaces:
Argument

public class MethodCallInstruction
extends Instruction
implements Argument

This class defines an instruction that consists of calling a method associated with a variable.


Constructor Summary
MethodCallInstruction(int lineNumber, Variable targetVariable, java.lang.String methodName, int methodNumber, Argument[] arguments)
          Creates a new method call instruction.
 
Method Summary
 void debugExecute(JobClass jobThread)
          Performs the function associated with this instruction, writing debug information about its execution to the client's message writer using the writeVerbose method.
 void execute(JobClass jobThread)
          Performs the function associated with this instruction.
 java.lang.String getArgumentAsString()
          Retrieves a string representation of this argument in a form appropriate for inclusion in a script.
 Argument[] getArguments()
          Retrieves the set of arguments that will be passed to the method.
 java.lang.String getArgumentType()
          Retrieves the name of the data type associated with this argument.
 Variable getArgumentValue()
          Retrieves the value of this argument.
 java.lang.String getMethodName()
          Retrieves the name of the method that will be executed.
 int getMethodNumber()
          Retrieves the method number for this method call.
 Variable getReturnValue()
          Retrieves the value returned from executing the method.
 Variable getTargetVariable()
          Retrieves the variable on which the instruction will be performed.
 java.lang.String getValueAsString()
          Retrieves a string representation of the value of this argument.
 java.lang.String toString(int indent)
          Retrieves a string representation of this instruction as could be found in a script file.
 
Methods inherited from class com.sun.slamd.scripting.engine.Instruction
getLineNumber, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodCallInstruction

public MethodCallInstruction(int lineNumber,
                             Variable targetVariable,
                             java.lang.String methodName,
                             int methodNumber,
                             Argument[] arguments)
Creates a new method call instruction.

Parameters:
lineNumber - The line number of the script on which this method call begins.
targetVariable - The variable on which the instruction will be performed.
methodName - The name of the method to execute.
methodNumber - The method number for this method call.
arguments - The set of arguments to pass to the method.
Method Detail

getTargetVariable

public Variable getTargetVariable()
Retrieves the variable on which the instruction will be performed.

Returns:
The variable on which the instruction will be performed.

getMethodName

public java.lang.String getMethodName()
Retrieves the name of the method that will be executed.

Returns:
The name of the method that will be executed.

getMethodNumber

public int getMethodNumber()
Retrieves the method number for this method call.

Returns:
The method number for this method call.

getArguments

public Argument[] getArguments()
Retrieves the set of arguments that will be passed to the method.

Returns:
The set of arguments that will be passed to the method.

getReturnValue

public Variable getReturnValue()
Retrieves the value returned from executing the method.

Returns:
The value returned from executing the method.

execute

public void execute(JobClass jobThread)
             throws ScriptException
Performs the function associated with this instruction.

Specified by:
execute in class Instruction
Parameters:
jobThread - The job thread that will be executing the script.
Throws:
ScriptException - If a problem occurs while processing this instruction.

debugExecute

public void debugExecute(JobClass jobThread)
                  throws ScriptException
Performs the function associated with this instruction, writing debug information about its execution to the client's message writer using the writeVerbose method.

Specified by:
debugExecute in class Instruction
Parameters:
jobThread - The job thread that will be executing the script.
Throws:
ScriptException - If a problem occurs while processing this instruction.

getArgumentType

public java.lang.String getArgumentType()
Retrieves the name of the data type associated with this argument.

Specified by:
getArgumentType in interface Argument
Returns:
The name of the data type associated with this argument.

getArgumentValue

public Variable getArgumentValue()
                          throws ScriptException
Retrieves the value of this argument.

Specified by:
getArgumentValue in interface Argument
Returns:
The value of this argument.
Throws:
ScriptException - If a problem occurs while determing the value of this argument.

toString

public java.lang.String toString(int indent)
Retrieves a string representation of this instruction as could be found in a script file. It may consist of multiple lines if necessary.

Specified by:
toString in class Instruction
Parameters:
indent - The number of spaces to indent the output.
Returns:
A string representation of this instruction as could be found in a script file.

getArgumentAsString

public java.lang.String getArgumentAsString()
Retrieves a string representation of this argument in a form appropriate for inclusion in a script.

Specified by:
getArgumentAsString in interface Argument
Returns:
A string representation of this argument in a form appropriate for inclusion in a script.

getValueAsString

public java.lang.String getValueAsString()
                                  throws ScriptException
Retrieves a string representation of the value of this argument.

Specified by:
getValueAsString in interface Argument
Returns:
A string representation of the value of this argument.
Throws:
ScriptException - If a problem occurs while trying to determine the value for this argument.