Juraji / intellij-tostring-format-plugin

IntelliJ platform plugin: Adds an action that will format Java's standard #toString() output, making it more readable.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java ToString Format

A JetBrains IntelliJ platform plugin to format Java's default toString() output to a JSON-like structure.

Why

When retrieving MBean data from JConsole or VisualVM the output is being formatted using Java's toString() method. Though MBeans are very convenient large output becomes unreadable. Hence, I needed something to format this output.

Why JSON?
The output already looks a lot like JSON, so I figured it would be fairly easy to use JSON as target format.

Installation

  1. Grab the build from the Github releases or build it yourself.
  2. Install the plugin from IntelliJ's Plugins manager using the Cogwheel in the top right and selecting "Install plugin from disk...".
  3. Open and editor, optionally select the toString() output, open up the actions pane and select "Format Java ToString to Json". Tada, your selection should be readableā„¢.

Known bugs

  • It is not very resilient...
    True, I created this for convenience, but it is definitely not monkey-proof.
  • Structural characters in values break the output.
    This is a linear lexical formatter. Meaning it does not (really) know in what context it is currently parsing. A { with in a string gets parsed as an object start and that's it.

About

IntelliJ platform plugin: Adds an action that will format Java's standard #toString() output, making it more readable.


Languages

Language:Kotlin 100.0%