atp-mipt / ljv

Lightweight Java Visualizer

Home Page:https://atp-mipt.github.io/ljv/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Lightweight Java Visualizer (LJV)

Actions Status: build Maven Central

LJV a is tool for visualizing Java data structures, using Graphviz.

It was developed by John Hamer in 2004 and released under GNU GPL (see the original project page).

This project aims to upgrade this tool to modern Java and make it an open source library in the modern sense of the word.

See documentation and JavaDoc.

How to use

The tool requires Java 11 or later version. Pull in the LJV dependency:

<dependency>
  <groupId>org.atp-fivt</groupId>
  <artifactId>ljv</artifactId>
  <version>1.04</version>
</dependency>

Execute the following (obj can be any object that you wish to visualize):

public class Main {
    public static void main(String[] args) {
        browse(new LJV(), Map.of(1, 'a', 2, 'b'));
    }

    public static void browse(LJV ljv, Object obj) {
        try {
            var dot = URLEncoder.encode(ljv.drawGraph(obj), "UTF8")
                        .replaceAll("\\+", "%20");
            Desktop.getDesktop().browse(
                new URI("https://dreampuf.github.io/GraphvizOnline/#" 
                        + dot));
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }
}

A browser window will appear with a diagram that will look like this:

Immutable MapN internal structure visualization

About

Lightweight Java Visualizer

https://atp-mipt.github.io/ljv/

License:GNU General Public License v3.0


Languages

Language:SCSS 33.8%Language:Less 33.4%Language:Java 28.6%Language:CSS 4.2%