public class TypeVisualizer extends Object
Currently, to use TypeVisualizer just insert an if statement somewhere that targets the type you would like to print: e.g.
if (type.getKind() == TypeKind.EXECUTABLE && type.toString().contains("methodToPrint")) {
TypeVisualizer.drawToPng("/Users/jburke/Documents/tmp/method.png", type);
}
Be sure to remove such statements before commiting your changes.Constructor and Description |
---|
TypeVisualizer() |
Modifier and Type | Method and Description |
---|---|
static void |
drawToDot(File dest,
AnnotatedTypeMirror type)
Creates a dot file at dest that contains a digraph for the structure of type
|
static void |
drawToDot(String dest,
AnnotatedTypeMirror type)
Creates a dot file at dest that contains a digraph for the structure of type
|
static void |
drawToPng(File dest,
AnnotatedTypeMirror type)
Draws a dot file for type in a temporary directory then calls the "dot" program to convert
that file into a png at the location dest.
|
static void |
drawToPng(String dest,
AnnotatedTypeMirror type)
Draws a dot file for type in a temporary directory then calls the "dot" program to convert
that file into a png at the location dest.
|
static void |
execDotToPng(File dotFile,
File pngFile)
Converts the given dot file to a png file at the specified location.
|
static boolean |
printTypevarToDotIfMatches(AnnotatedTypeMirror.AnnotatedTypeVariable typeVariable,
List<String> typeVarNames,
String directory)
If the name of typeVariable matches one in the list of typeVarNames, then print typeVariable
to a dot file at directory/varName.dot
|
static boolean |
printTypevarToPngIfMatches(AnnotatedTypeMirror.AnnotatedTypeVariable typeVariable,
List<String> typeVarNames,
String directory)
If the name of typeVariable matches one in the list of typeVarNames, then print typeVariable
to a png file at directory/varName.png
|
public static void drawToDot(File dest, AnnotatedTypeMirror type)
dest
- the destination dot filetype
- the type to be writtenpublic static void drawToDot(String dest, AnnotatedTypeMirror type)
dest
- the destination dot file, this string will be directly passed to new File(dest)type
- the type to be writtenpublic static void drawToPng(File dest, AnnotatedTypeMirror type)
dest
- the destination png filetype
- the type to be writtenpublic static void drawToPng(String dest, AnnotatedTypeMirror type)
dest
- the destination png file, this string will be directly passed to new File(dest)type
- the type to be writtenpublic static void execDotToPng(File dotFile, File pngFile)
dotFile
- the dot file to convertpngFile
- the destination of the resultant png filepublic static boolean printTypevarToDotIfMatches(AnnotatedTypeMirror.AnnotatedTypeVariable typeVariable, List<String> typeVarNames, String directory)
public static boolean printTypevarToPngIfMatches(AnnotatedTypeMirror.AnnotatedTypeVariable typeVariable, List<String> typeVarNames, String directory)