classycle
Class Parser

java.lang.Object
  extended by classycle.Parser

public class Parser
extends java.lang.Object

Utility methods for parsing class files and creating directed graphs. The nodes of the graph are classes. The initial vertex of an edge is the class which uses the class specified by the terminal vertex.

Author:
Franz-Josef Elmer

Method Summary
static AtomicVertex[] readClassFiles(java.lang.String[] classFiles)
          Reads and parses class files and creates a direct graph.
static AtomicVertex[] readClassFiles(java.lang.String[] classFiles, StringPattern pattern, StringPattern reflectionPattern, boolean mergeInnerClasses)
          Reads the specified class files and creates a directed graph where each vertex represents a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readClassFiles

public static AtomicVertex[] readClassFiles(java.lang.String[] classFiles)
                                     throws java.io.IOException
Reads and parses class files and creates a direct graph. Short-cut of readClassFiles(classFiles, new TrueStringPattern(), null, false);

Throws:
java.io.IOException

readClassFiles

public static AtomicVertex[] readClassFiles(java.lang.String[] classFiles,
                                            StringPattern pattern,
                                            StringPattern reflectionPattern,
                                            boolean mergeInnerClasses)
                                     throws java.io.IOException
Reads the specified class files and creates a directed graph where each vertex represents a class. The head vertex of an arc is a class which is used by the tail vertex of the arc. The elements of classFiles are file names (relative to the working directory) which are interpreted depending on its file type as Folders and zip/jar/war/ear files are searched recursively for class files. If a folder is specified only the top-level zip/jar/war/ear files of that folder are analysed.

Parameters:
classFiles - Array of file names.
pattern - Pattern fully qualified class names have to match in order to be added to the graph. Otherwise they count as 'external'.
reflectionPattern - Pattern ordinary string constants of a class file have to fullfill in order to be handled as class references. In addition they have to be syntactically valid fully qualified class names. If null ordinary string constants will not be checked.
mergeInnerClasses - If true merge inner classes with its outer class
Returns:
directed graph.
Throws:
java.io.IOException