Java Reference
In-Depth Information
Table 6.5 The icons in the Frame tab of the Debug tool window show what sort of data is active in
the running application.
Icon
Meaning
A primitive value, such as an int or a char .
An array. You can expand it to view its contents.
An object reference (except for arrays). Expandable to view its members, if any.
The new version of IDEA adds the ability to customize how objects are displayed
in the debugger on a class-by-class basis, allowing you to assign an expression to
display rather than relying solely on the object's String representation. For exam-
ple, if an object represents a user, you may want to see users represented by their
login name; or, for a cache entry object, its age and contents may be appropriate.
IDEA refers to these as type renderers .
To create your own custom type renderers, bring up the Debugger settings
panel and select the Type Renderers tab (see figure 6.8). This panel lists all the
renderers you've defined and allows you to turn them on and off at any time
using the checkbox next to their name. The order of the list determines which
renderer is used in the case of ambiguity born of class inheritance. For each ren-
derer, you specify a name, the object class for which it applies, and which expres-
sions to use while rendering.
The first option determines how the object is displayed in the debugger. You
can type in the expression you want to use to identify the object. In figure 6.9,
we've created an expression that displays the user's full name by accessing the
first and last name properties of the object. Note that you can use constants and
string math as part of your renderer.
The second option is used when expanding the node. Normally, expanding a
node in the debugger lists the object's member variables (using whatever ren-
derer is appropriate for their object types). This option lets you override that
behavior and select a single expression or a series of expressions to control the
display. You may use this to limit the amount of information displayed or to be
more precise in how the information is presented for example. In this example,
we've elected to reflect only three of the object's properties and have used
descriptive names rather than the member variable's name.
 
 
Search WWH ::




Custom Search