Skip to content

atp-mipt/ljv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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