Type Renderer

Custom Type Renderers #

IntelliJ allows to provide custom type renderers to display in the debugger which are called Type Renderers which change the textual description, effectively rewriting the toString() method of the object in the debugger. One example where this could be useful is when creating specific types specified in the model (e.g. an KeyValuePair which is an AggregateObject storing two values) to show both values instead of using the default toString() of AggregateObject:

Debugger with the default type renderer for AggregateObject:


Debugger with a custom type renderer for KeyValuePair:


Creating a custom Type Renderer #

Go into the Settings (Ctrl + Alt + S) and then Build, Execution, Deployment > Debugger > Data Views > Java Type Renderers and add one using the + button and assign it any name.


The renderer needs to be applied to certain objects which need to be specified (in this case, de.uni_trier.wi2.procake.data.object.base.AggregateObject). You can use the ... button to search through all objects in all projects.

Change Use default renderer to Use following expression, to insert the code how the classes should be rendered. This code for this example is the following:

if (this.getDataClass().toString().equals("KeyValuePair")) {
    var values = this.getAttributeMap().values().toArray();
    return ((AtomicObject) values[0]).getNativeObject() + " -> " + ((AtomicObject) values[1]).getNativeObject();
} else {
    return this.toString() + " -> " + this.getAttributeMap();

Note: As this code is solely for the display of values in the debugger, it is written to be as fast and short as possible. You should not check for equality of Data Classes by String Equality in production code.

If the On-demand checkbox is checked, the debugger display will only be evaluated when pressing a button. Use this if the expression in the code takes too long to calculate.

More Information #

Additional information can be found in the IntelliJ Documentation