Example usage for org.eclipse.jdt.core.dom VariableDeclarationStatement accept

List of usage examples for org.eclipse.jdt.core.dom VariableDeclarationStatement accept

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom VariableDeclarationStatement accept.

Prototype

public final void accept(ASTVisitor visitor) 

Source Link

Document

Accepts the given visitor on a visit of the current node.

Usage

From source file:egovframework.mgt.fit.library.parser.visitor.LocalVariableParsingVisitor.java

License:Apache License

/**
 *    ?  ?? ?.// ww w . j  av a  2  s. c  om
 * @return   
 */
@Override
public boolean visit(VariableDeclarationStatement node) {
    if (node instanceof VariableDeclarationStatement) {
        for (Object obj : node.fragments()) {
            if (obj instanceof VariableDeclaration) {
                VariableDeclaration vd = (VariableDeclaration) obj;
                Variable lv = new Variable();
                lv.setModifier(node.getModifiers());
                lv.setType(
                        project.resolveClass(javaClass.getFullnameWithSimpleName(node.getType().toString())));
                lv.setName(vd.getName().getFullyQualifiedName());
                lv.setValue(StringHelper.safeToString(vd.getInitializer()));
                node.accept(new AnnotationParsingVisitor(lv, ASTNode.VARIABLE_DECLARATION_STATEMENT));
                lv.setNode(vd);
                method.addLocalVariable(lv);
            }
        }
    }
    return super.visit(node);
}