Skip to content

atp-mipt/ljv

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
doc
 
 
ljv
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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