CountingVisitorDJ { // how to use: // to count all X-objects // change "Weight" to "X" // Java does not support this parameterization {{ public void start() { total=0; System.out.println("begin"); } public void before(Weight o) { System.out.println("count"); total++; System.out.println("before Weight"); } public Object getReturnValue() {return new Integer(total);} }} }