private void printMembers(final List<BodyDeclaration> members, final Object arg) { for (final BodyDeclaration member : members) { printer.printLn(); member.accept(this, arg); printer.printLn(); } }
public BodyDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations) { super(beginLine, beginColumn, endLine, endColumn); setAnnotations(annotations); }
private AnnotationExpr findAnnotation(final BodyDeclaration n, String fullyQualifiedName, boolean foundAnnImport) { final String simpleName = ClassUtils.getShortClassName(fullyQualifiedName); final List<AnnotationExpr> annotations = n.getAnnotations() != null ? n.getAnnotations() : new ArrayList<AnnotationExpr>(); for (AnnotationExpr ae : annotations) { final String name = ae.getName().toString(); if ((simpleName.equals(name) && foundAnnImport)) { LOG.info("found " + ae + " on " + getTypeOrFieldNameForMsg(n) + "."); return ae; } if (fullyQualifiedName.equals(name)) { LOG.info("found " + ae + " on " + getTypeOrFieldNameForMsg(n) + "."); return ae; } } return null; }
private static Clip clip(BodyDeclaration body) { return Clip.get(body.getBeginLine() - 1, 0, body.getEndLine() - 1, body.getEndColumn()); }
final List<AnnotationExpr> annotations = n.getAnnotations() != null ? n.getAnnotations() : new ArrayList<AnnotationExpr>(); annotations.remove(existingAnnotation); n.setAnnotations(annotations); if (nodes != null && nodes.annotation != null) { LOG.info("adding " + nodes.annotation + " to " + getTypeOrFieldNameForMsg(n) + "."); final List<AnnotationExpr> annotations = n.getAnnotations() != null ? n.getAnnotations() : new ArrayList<AnnotationExpr>(); annotations.add(nodes.annotation); n.setAnnotations(annotations);
public final void setAnnotations(List<AnnotationExpr> annotations) { this.annotations = annotations; setAsParentNodeOf(this.annotations); } }
final String javaDoc(BodyDeclaration node) { JavadocComment doc = node.getJavaDoc(); return doc != null ? clip(doc) : null; }
private void printMembers(List<BodyDeclaration> members, Object arg) { for (BodyDeclaration member : members) { printer.printLn(); member.accept(this, arg); printer.printLn(); } }
public BodyDeclaration(List<AnnotationExpr> annotations) { setAnnotations(annotations); }
@Override public Node visit(final AnnotationDeclaration n, final A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } final List<AnnotationExpr> annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } final List<BodyDeclaration> members = n.getMembers(); if (members != null) { for (int i = 0; i < members.size(); i++) { members.set(i, (BodyDeclaration) members.get(i).accept(this, arg)); } removeNulls(members); } return n; }
@Override public Node visit(final EnumConstantDeclaration n, final A arg) { if (n.getJavaDoc() != null) { n.setJavaDoc((JavadocComment) n.getJavaDoc().accept(this, arg)); } final List<AnnotationExpr> annotations = n.getAnnotations(); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { annotations.set(i, (AnnotationExpr) annotations.get(i).accept(this, arg)); } removeNulls(annotations); } final List<Expression> args = n.getArgs(); if (args != null) { for (int i = 0; i < args.size(); i++) { args.set(i, (Expression) args.get(i).accept(this, arg)); } removeNulls(args); } final List<BodyDeclaration> classBody = n.getClassBody(); if (classBody != null) { for (int i = 0; i < classBody.size(); i++) { classBody.set(i, (BodyDeclaration) classBody.get(i).accept(this, arg)); } removeNulls(classBody); } return n; }
if (members != null) { for (int i = 0; i < members.size(); i++) { members.set(i, (BodyDeclaration) members.get(i).accept(this, arg));
@Override public Node visit(final ObjectCreationExpr n, final A arg) { if (n.getScope() != null) { n.setScope((Expression) n.getScope().accept(this, arg)); } final List<Type> typeArgs = n.getTypeArgs(); if (typeArgs != null) { for (int i = 0; i < typeArgs.size(); i++) { typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg)); } removeNulls(typeArgs); } n.setType((ClassOrInterfaceType) n.getType().accept(this, arg)); final List<Expression> args = n.getArgs(); if (args != null) { for (int i = 0; i < args.size(); i++) { args.set(i, (Expression) args.get(i).accept(this, arg)); } removeNulls(args); } final List<BodyDeclaration> anonymousClassBody = n.getAnonymousClassBody(); if (anonymousClassBody != null) { for (int i = 0; i < anonymousClassBody.size(); i++) { anonymousClassBody.set(i, (BodyDeclaration) anonymousClassBody.get(i).accept(this, arg)); } removeNulls(anonymousClassBody); } return n; }
if (members != null) { for (int i = 0; i < members.size(); i++) { members.set(i, (BodyDeclaration) members.get(i).accept(this, arg));
@Override public void visit(final ClassOrInterfaceDeclaration n, final String mappedClass) { annotationHelper.visitPre(n, mappedClass); ParserUtil.deconstructMultiDeclarations(ParserUtil.getFieldMembers(n.getMembers())); if (n.getMembers() != null) { for (final BodyDeclaration member : n.getMembers()) { member.accept(this, mappedClass); } } annotationHelper.visitPost(n, mappedClass); }
@Override public void visit(final AnnotationDeclaration n, final A arg) { visitComment(n.getComment(), arg); if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (final AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getMembers() != null) { for (final BodyDeclaration member : n.getMembers()) { member.accept(this, arg); } } }
for (final BodyDeclaration member : n.getMembers()) { R result = member.accept(this, arg); if (result != null) { return result;
@Override public void visit(final EnumConstantDeclaration n, final A arg) { visitComment(n.getComment(), arg); if (n.getJavaDoc() != null) { n.getJavaDoc().accept(this, arg); } if (n.getAnnotations() != null) { for (final AnnotationExpr a : n.getAnnotations()) { a.accept(this, arg); } } if (n.getArgs() != null) { for (final Expression e : n.getArgs()) { e.accept(this, arg); } } if (n.getClassBody() != null) { for (final BodyDeclaration member : n.getClassBody()) { member.accept(this, arg); } } }
for (final BodyDeclaration member : n.getClassBody()) { R result = member.accept(this, arg); if (result != null) { return result;
@Override public void visit(final ObjectCreationExpr n, final A arg) { visitComment(n.getComment(), arg); if (n.getScope() != null) { n.getScope().accept(this, arg); } if (n.getTypeArgs() != null) { for (final Type t : n.getTypeArgs()) { t.accept(this, arg); } } n.getType().accept(this, arg); if (n.getArgs() != null) { for (final Expression e : n.getArgs()) { e.accept(this, arg); } } if (n.getAnonymousClassBody() != null) { for (final BodyDeclaration member : n.getAnonymousClassBody()) { member.accept(this, arg); } } }