Kalimantan - Inspector

version 1.0b2
Copyright (c) 1995, DSTC

The Inspector

The Inspector is a tool for exploring the (possibly nested) contents of an object. If you're sick of writing lots of print statements to try to see if your objects contain the right data five levels down, then the Inspector is for you.

How To

The following piece of code opens an InspectorFrame on a simple string.
import dstc.kalimantan.inspect.*;

public class Test extends Object
{
    public static void main(String args[])
    {
        InspectorFrame.on("Hello sailor!");
    }
}

Execution of this piece of code results in the inspector window shown below. The title of the window indicates the class of the object being inspected, in this case a String. As you can see, a String is not a primitive data type, but is rather composed of three other objects. On the left hand side is a list of the names of the instance variables of the object. The text area on the right hand side contains the string Hello Sailor, representing the contents of the object.

Inspector Frame

When one of the instance variables on the left is selected, the text area on the right is updated to reflect its contents, as shown below. The Inspector window executes in a separate thread and the instance variables are therefore subject to change. If the contents of that instance variable do change, the change will be reflected the next time the instance variable is displayed. It will not be automatically updated while you view it, but selecting and deselecting the instance variable name will force an update.

Inspector Frame with selection

The Back and Forward buttons along the bottom can be used in a style that will be familiar to users of web browsers. The Forward button will inspect the selected instance variable, replacing the current list of instance variables with the instance variables of the of that object. The Inspector keeps track of which objects have been inspected, and so pushing the Back button returns you to the object you were previously inspecting. The Spawn button will create a new Inspector window on the selected object, which is useful when you wish to compare several different fields. And finally, the Close button will make the window go away, which is quite handy after you've spawned 300 of these things.

Inspector Frame with selection

If you're interested in extending the Inspector, the api documentation is available here.

Known Bugs:


Ted Phelps <phelps@dstc.edu.au>