public String getName() { return name == null ? null : name.getName(); }
public String getName() { return name.getName(); }
public String getName() { return name.getName(); }
public final String getName() { return name.getName(); }
public String getField() { return field.getName(); }
public void visit(NameExpr n, Object arg) { printer.print(n.getName()); }
private String toString(NameExpr n) { if (n instanceof QualifiedNameExpr) { QualifiedNameExpr qn = (QualifiedNameExpr)n; return qn.getQualifier() + "." + qn.getName(); } else { return n.getName(); } }
@Override public void visit(final NameExpr n, final Object arg) { printJavaComment(n.getComment(), arg); printer.print(n.getName()); printOrphanCommentsEnding(n); }
@Override public void visit(MethodDeclaration n, Object arg) { // here you can access the attributes of the method. // this method will be called for all methods in this // CompilationUnit, including inner class methods currentMethod = new CGEntry(TYPE.METHOD, currentClass, currentMethod, n.getName()); if (isDebug()) System.out.println("M:" + currentMethod); list.add(currentMethod); List<AnnotationExpr> annos = n.getAnnotations(); if (annos != null) { for (AnnotationExpr anno : annos) { if (isDebug()) System.out.println("A:" + anno.getName()); currentMethod.addAnnotation(new CGEntry(TYPE.ANNOTATION, currentClass, currentMethod, anno.getName().getName())); } } super.visit(n, arg); if (currentMethod != null) currentMethod = currentMethod.getMethod(); }
public void build() { UnitChromatticVisitor unitChromatticVisitor = new UnitChromatticVisitor(); compilationUnit.getPackage().getName().setName(compilationUnit.getPackage().getName().getName() + ".groovy"); unitChromatticVisitor.visit(compilationUnit, null); sb.append(compilationUnit.toString(new GroovyCompatibilityFactory())); }
@Override public void visit(FieldDeclaration n, Object arg) { for (VariableDeclarator var : n.getVariables()) { CGEntry currentVariable = new CGEntry(TYPE.VARIABLE, currentClass, currentMethod, var.getId().getName()); if (isDebug()) System.out.println("V:" + currentVariable); list.add(currentVariable); List<AnnotationExpr> annos = n.getAnnotations(); if (annos != null) { for (AnnotationExpr anno : annos) { if (isDebug()) System.out.println("A:" + anno.getName()); currentVariable.addAnnotation(new CGEntry(TYPE.ANNOTATION, currentClass, currentMethod, anno.getName().getName())); } } } super.visit(n, arg); }
@Override public void visit(ClassOrInterfaceDeclaration n, Object arg) { currentClass = new CGEntry(CGEntry.TYPE.CLASS, currentClass, null, n.getName()); if (mainClass == null) { mainClass = currentClass; mainClass.setMainClass(true); mainClass.setPackage(pack); } if (isDebug()) System.out.println("C:" + currentClass); list.add(currentClass); List<AnnotationExpr> annos = n.getAnnotations(); if (annos != null) { for (AnnotationExpr anno : annos) { if (isDebug()) System.out.println("A:" + anno.getName()); currentClass.addAnnotation(new CGEntry(TYPE.ANNOTATION, currentClass, currentMethod, anno.getName().getName())); } } super.visit(n, arg); if (currentClass != null ) currentClass = currentClass.getClazz(); }
@Override public Node visit(NameExpr _n, Object _arg) { Comment comment = cloneNodes(_n.getComment(), _arg); NameExpr r = new NameExpr( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getName() ); r.setComment(comment); return r; }