About DesignWizard

From DesignWizardWiki

(Redirected from About)
Jump to: navigation, search

DesignWizard is an API that supports the automated inspection of Java programs. It reads the design from "jar" files into a data structure. Once the design is in memory, a broad set of queries can be used to analyze and check the design. Its use follows a very simple pattern as well as the method names in its facade. Let us see some simple examples.

The first step is to create a DesignWizard object from a given "jar" file:

DesignWizard dw = new DesignWizard("myproject.jar");

Next, we use the DesignWizard API's to check or query the design as desired. For instance, we can get the number of classes in the "jar".

int numberOfClasses = dw.getAllClasses().size();

Or we may want to assure no static methods exist within the project:

assert dw.getStaticMethods().size() == 0;

We can be more selective, as well. For instance, we may want to check that no classes, except for a given one, accesses System.out and System.in:

Set<String> uiUsers = dw.getClassesThatUse("System.in", "System.out");
assertEquals(1, uiUsers.size());
String ui = new LinkedList(uiUsers).getFirst();
Personal tools