Skip to content

Instantly share code, notes, and snippets.

@samueltcsantos
Created April 19, 2014 23:15
Show Gist options
  • Save samueltcsantos/11100456 to your computer and use it in GitHub Desktop.
Save samueltcsantos/11100456 to your computer and use it in GitHub Desktop.
Implementando um visitor para localizar os métodos.
package com.jdt.info.handlers;
import java.util.List;
import java.util.ArrayList;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.MethodDeclaration;
/**
* Implementing a custom method visitor.
*
* @author Samuel T. C. Santos
*
*/
public class MethodVisitor extends ASTVisitor {
private List<MethodDeclaration> methodList = new ArrayList<MethodDeclaration>();
@Override
public boolean visit(MethodDeclaration node) {
methodList.add(node);
return super.visit(node);
}
/**
* Get all method visited by MethodVisitor.
*
* @return
*/
public List<MethodDeclaration> getMethods(){
return methodList;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment