com.bluemarsh.jswat.command
Class printCommand
java.lang.Object
|
+--com.bluemarsh.jswat.command.JSwatCommand
|
+--com.bluemarsh.jswat.command.printCommand
- public class printCommand
- extends JSwatCommand
Defines the class that handles the 'print' command.
- Author:
- Nathan Fiedler, Torsten Schlüter (t.schlueter@gmx.de)
Method Summary |
protected java.lang.String |
callToString(com.sun.jdi.ObjectReference obj,
com.sun.jdi.ThreadReference thread)
Call the toString() method on the given object. |
void |
perform(Session session,
com.bluemarsh.util.StringTokenizer args,
Log out)
Perform the 'print' command. |
protected void |
printVariable(java.lang.String expr,
com.sun.jdi.ThreadReference thread,
int frame,
Log out)
Prints value of a Variable defined by 'expr'. |
Methods inherited from class com.bluemarsh.jswat.command.JSwatCommand |
argumentsMatch, createObject, description, findClassesByPattern, getCommandName, getPromptString, getThreadByID, help, help, missingArgs, receiveInput, resolveOverload |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
printCommand
public printCommand()
callToString
protected java.lang.String callToString(com.sun.jdi.ObjectReference obj,
com.sun.jdi.ThreadReference thread)
- Call the
toString()
method on the given object.
- Parameters:
obj
- object on which to call toString().thread
- thread on which to call toString() on obj.- Returns:
- Return value from
obj.toString()
, or
null if there was any problem.
perform
public void perform(Session session,
com.bluemarsh.util.StringTokenizer args,
Log out)
- Perform the 'print' command.
- Overrides:
perform
in class JSwatCommand
- Parameters:
session
- JSwat session on which to operate.args
- Tokenized string of command arguments.out
- Output to write messages to.
printVariable
protected void printVariable(java.lang.String expr,
com.sun.jdi.ThreadReference thread,
int frame,
Log out)
throws com.sun.jdi.AbsentInformationException,
com.sun.jdi.ClassNotPreparedException,
FieldNotObjectException,
java.lang.IllegalThreadStateException,
com.sun.jdi.IncompatibleThreadStateException,
java.lang.IndexOutOfBoundsException,
com.sun.jdi.InvalidStackFrameException,
java.lang.NoSuchFieldException,
com.sun.jdi.ObjectCollectedException
- Prints value of a Variable defined by 'expr'. This variable could be a
primitive, object reference or arrayReference. If the computed value is
instance of ArrayReference and expr ends with "[]"
all elements of the array are displayed.
- Parameters:
expr
- user input, it is used to get values, fields and so on.thread
- current ThreadReference.frame
- current frame delivered by ContextManager.out
- Log to write output to.- Throws:
com.sun.jdi.AbsentInformationException
- Thrown if class doesn't have local variable info.java.lang.ArrayIndexOutOfBoundsException
- Thrown if expr array reference is out of range.com.sun.jdi.ClassNotPreparedException
- Thrown if the object's class is not loaded.FieldNotObjectException
- Thrown if a non-object is encountered.java.lang.IllegalThreadStateException
- Thrown if thread is not currently running.com.sun.jdi.IncompatibleThreadStateException
- Thrown if thread is not suspended.java.lang.IndexOutOfBoundsException
- Thrown if frame
is out of bounds.com.sun.jdi.InvalidStackFrameException
- Thrown if index
is out of bounds.java.lang.NoSuchFieldException
- Thrown if the field was not found in the object.com.sun.jdi.ObjectCollectedException
- Thrown if the referenced object has been collected.