com.bluemarsh.jswat.command
Class localsCommand

java.lang.Object
  |
  +--com.bluemarsh.jswat.command.JSwatCommand
        |
        +--com.bluemarsh.jswat.command.localsCommand

public class localsCommand
extends JSwatCommand

Defines the class that handles the 'locals' command.

Author:
Nathan Fiedler

Fields inherited from class com.bluemarsh.jswat.command.JSwatCommand
logCategory, primitiveTypeNames, swat
 
Constructor Summary
localsCommand()
           
 
Method Summary
protected  java.util.Map getVariables(com.sun.jdi.StackFrame frame)
          Builds a map of all visible variables, including local variables and field variables.
 void perform(Session session, com.bluemarsh.util.StringTokenizer args, Log out)
          Perform the 'locals' command.
protected  void printLocals(com.sun.jdi.ThreadReference thread, int index, Log out)
          Display the visible local variables for this stack frame.
 
Methods inherited from class com.bluemarsh.jswat.command.JSwatCommand
argumentsMatch, createObject, description, findClassesByPattern, getCommandName, getThreadByID, help, help, missingArgs, receiveInput, resolveOverload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

localsCommand

public localsCommand()
Method Detail

perform

public void perform(Session session,
                    com.bluemarsh.util.StringTokenizer args,
                    Log out)
Perform the 'locals' 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.

printLocals

protected void printLocals(com.sun.jdi.ThreadReference thread,
                           int index,
                           Log out)
Display the visible local variables for this stack frame.
Parameters:
thread - ThreadReference
index - Frame index.
out - Output to write variables to.

getVariables

protected java.util.Map getVariables(com.sun.jdi.StackFrame frame)
                              throws com.sun.jdi.AbsentInformationException,
                                     com.sun.jdi.InvalidStackFrameException,
                                     com.sun.jdi.NativeMethodException
Builds a map of all visible variables, including local variables and field variables. The returned Map contains both LocalVariable objects and Field objects, all keyed by their String names. The map is sorted and so iterating it will return the variables in alphabetical order.
Returns:
map of visible variables in sorted order.
Throws:
com.sun.jdi.AbsentInformationException - Thrown if the variable information is missing.
com.sun.jdi.InvalidStackFrameException - Thrown if the stack frame is invalid.
com.sun.jdi.NativeMethodException - Thrown if this method is a native one.