A Swing-based interactive console for evaluating Groovy expressions and scripts with syntax highlighting, code completion, and an integrated AST browser.
—
The Object Inspector provides comprehensive runtime object introspection and property browsing capabilities for debugging and exploration of Groovy objects and Java objects.
class ObjectBrowser {
// Static Entry Points
static void main(String[] args)
static void inspect(Object objectUnderInspection)
}main() Parameters:
args (String[]): Command line arguments for standalone object browserinspect() Parameters:
objectUnderInspection (Object): Any object to inspect - can be Groovy objects, Java objects, collections, etc.class ButtonOrTextEditor extends AbstractCellEditor implements TableCellEditor {
// Table cell editor that can display buttons or editable text
}
class ButtonOrDefaultRenderer extends DefaultTableCellRenderer {
// Table cell renderer for button or default text display
}These components provide interactive table cells in the object inspector for:
def myObject = [name: 'John', age: 30, items: ['a', 'b', 'c']]
groovy.console.ui.ObjectBrowser.inspect(myObject)
// Or using legacy API
groovy.inspect.swingui.ObjectBrowser.inspect(myObject)// Launch standalone object browser
groovy.console.ui.ObjectBrowser.main([] as String[])class Person {
String name
int age
List<String> hobbies
Map<String, Object> metadata
def greet() { "Hello, I'm $name" }
}
def person = new Person(
name: 'Alice',
age: 25,
hobbies: ['reading', 'coding', 'hiking'],
metadata: [location: 'NYC', active: true]
)
// Inspect the complex object
groovy.console.ui.ObjectBrowser.inspect(person)def complexList = [
[name: 'Item 1', value: 100],
[name: 'Item 2', value: 200, nested: [a: 1, b: 2]],
new Date(),
42,
'Hello World'
]
groovy.console.ui.ObjectBrowser.inspect(complexList)import java.util.concurrent.ConcurrentHashMap
def javaMap = new ConcurrentHashMap()
javaMap.put('key1', 'value1')
javaMap.put('key2', [subkey: 'subvalue'])
groovy.console.ui.ObjectBrowser.inspect(javaMap)The Object Inspector integrates seamlessly with the main Console:
From the Console, access object inspection via:
// In console, after running a script:
def result = someComplexOperation()
// Then use: console.inspectLast() to inspect 'result'The Object Inspector displays:
The inspector handles:
The same object inspection functionality is available in the legacy package:
// Legacy imports (same API as groovy.console.ui)
import groovy.inspect.swingui.ObjectBrowser
import groovy.inspect.swingui.ButtonOrTextEditor
import groovy.inspect.swingui.ButtonOrDefaultRendererThe inspector provides:
Use with debugging:
The object browser supports:
Install with Tessl CLI
npx tessl i tessl/maven-org-codehaus-groovy--groovy-console