Main { // put into class Main {{ public static ClassGraph buildClassGraph() { ClassGraph cg=new ClassGraph(true,false); // true: include all fields // false: do NOT include all non-void no-argument methods System.out.println("The DJ version is: " + cg.getVersion()); System.out.println("The class graph is" + "============================="); System.out.println(cg); System.out.println("end class graph " + "============================="); return cg; } }} } Utility { // put into Utility {{ static Integer countInhRelsDJ (ObjectGraphSlice subClassSlice) { CountingVisitorDJ count = new CountingVisitorDJ(); Integer result = (Integer) subClassSlice.traverse(count); return result; } }} } CountingVisitorDJ { {{ public void start() { c=0; System.out.println("begin"); } public void before(Vertex o) { c++; System.out.println("before Vertex"); } public void after(Cd_graph o) { System.out.println("after Cd_graph"); } public Object getReturnValue() {return new Integer(c);} }} }