CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-codehaus-groovy--groovy-console

A Swing-based interactive console for evaluating Groovy expressions and scripts with syntax highlighting, code completion, and an integrated AST browser.

Pending
Overview
Eval results
Files

object-inspector.mddocs/

Object Inspector

The Object Inspector provides comprehensive runtime object introspection and property browsing capabilities for debugging and exploration of Groovy objects and Java objects.

Main Object Browser

class ObjectBrowser {
    // Static Entry Points
    static void main(String[] args)
    static void inspect(Object objectUnderInspection)
}

Parameters

main() Parameters:

  • args (String[]): Command line arguments for standalone object browser

inspect() Parameters:

  • objectUnderInspection (Object): Any object to inspect - can be Groovy objects, Java objects, collections, etc.

Returns

  • main(): void - Launches standalone object browser application
  • inspect(): void - Opens object inspector window for the specified object

Table Components

Interactive Cell Editors

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:

  • Expandable object properties
  • Editable values where appropriate
  • Button-triggered actions for complex objects

Usage Examples

Basic Object Inspection

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)

Standalone Object Browser

// Launch standalone object browser
groovy.console.ui.ObjectBrowser.main([] as String[])

Inspecting Complex Objects

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)

Inspecting Collections

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)

Inspecting Java Objects

import java.util.concurrent.ConcurrentHashMap

def javaMap = new ConcurrentHashMap()
javaMap.put('key1', 'value1')
javaMap.put('key2', [subkey: 'subvalue'])

groovy.console.ui.ObjectBrowser.inspect(javaMap)

Integration with Console

The Object Inspector integrates seamlessly with the main Console:

Console Integration Methods

From the Console, access object inspection via:

  • inspectLast() method - Inspects the result of the last executed expression
  • inspectVariables() method - Inspects all variables in the current binding
  • Menu options for object inspection

Variable Inspection

// In console, after running a script:
def result = someComplexOperation()
// Then use: console.inspectLast() to inspect 'result'

Object Inspector Features

Property Browsing

The Object Inspector displays:

  • Properties: All accessible properties with their values
  • Methods: Available methods (non-executable in browser)
  • Fields: Public and accessible fields
  • Type Information: Class hierarchy and type details

Interactive Features

  • Expandable Trees: Navigate nested object structures
  • Value Editing: Modify simple property values where possible
  • Search and Filter: Find specific properties or methods
  • Export Options: Save inspection results

Supported Object Types

The inspector handles:

  • Groovy Objects: Full property and method introspection
  • Java Objects: Reflection-based property access
  • Collections: Lists, Maps, Sets with element browsing
  • Arrays: Multi-dimensional array exploration
  • Primitive Wrappers: Integer, String, Boolean, etc.
  • Custom Classes: User-defined classes and their properties

Legacy API

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.ButtonOrDefaultRenderer

Advanced Inspection

Deep Object Analysis

The inspector provides:

  • Circular Reference Detection: Handles self-referencing objects safely
  • Lazy Loading: Loads complex nested objects on demand
  • Memory-Safe Browsing: Avoids loading entire large collections
  • Type Hierarchy Display: Shows inheritance chains and implemented interfaces

Debugging Integration

Use with debugging:

  • Inspect exception objects to understand error states
  • Browse stack trace elements and their properties
  • Examine thread states and concurrent objects
  • Analyze performance-related object metrics

Customization

The object browser supports:

  • Custom renderers for specific object types
  • Configurable display depth for nested objects
  • Filtered views to show only relevant properties
  • Export formats for external analysis

Install with Tessl CLI

npx tessl i tessl/maven-org-codehaus-groovy--groovy-console

docs

ast-browser.md

console-application.md

index.md

object-inspector.md

system-integration.md

text-editing.md

tile.json