LocalClassDeclaration lcd = ...; lcd.accept(new Traverser { int n = 0; public void traverseMethodDeclarator(Java.MethodDeclarator md) { ++this.n; super.traverseMethodDeclarator(md); } }.comprehensiveVisitor());