Example usage for org.aspectj.org.eclipse.jdt.core.dom BeforeAdviceDeclaration parameters

List of usage examples for org.aspectj.org.eclipse.jdt.core.dom BeforeAdviceDeclaration parameters

Introduction

In this page you can find the example usage for org.aspectj.org.eclipse.jdt.core.dom BeforeAdviceDeclaration parameters.

Prototype

public List parameters() 

Source Link

Document

Returns the live ordered list of method parameter declarations for this method declaration.

Usage

From source file:ajdtplugin.AjNaiveASTFlattener.java

License:Open Source License

public boolean visit(BeforeAdviceDeclaration node) {
    ////w ww .  j  ava  2 s. c o  m
    instBefore = new AdviceBefore();
    instBefore.setAdviceTypeName(this.adviceType);

    List<String> param = new ArrayList<String>();
    printIndent();
    this.buffer.append("before");
    this.buffer.append("(");
    List<?> parameters = node.parameters();
    for (Iterator<?> iter = parameters.iterator(); iter.hasNext();) {
        SingleVariableDeclaration element = (SingleVariableDeclaration) iter.next();
        buffer.append(element.getType().toString() + " " + element.getName() + "");
        //
        instBefore.getParameterTypes().add(element.getType().toString());
        param.add(element.getName().toString());
        if (iter.hasNext())
            buffer.append(", ");
    }
    this.buffer.append("):");
    //
    instBefore.setPointcut((ReferencePointcut) node.getPointcut());
    instBefore.setPointcutName(((ReferencePointcut) node.getPointcut()).getName().toString());

    node.getPointcut().accept(this);
    this.buffer.append("(");
    for (Iterator<String> iter = param.iterator(); iter.hasNext();) {
        String para = iter.next();
        this.buffer.append(para);
        if (iter.hasNext())
            buffer.append(", ");
    }
    this.buffer.append(")");
    node.getBody().accept(this);
    return false;
}