Example usage for org.aspectj.org.eclipse.jdt.core.dom AfterThrowingAdviceDeclaration getPointcut

List of usage examples for org.aspectj.org.eclipse.jdt.core.dom AfterThrowingAdviceDeclaration getPointcut

Introduction

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

Prototype

public PointcutDesignator getPointcut() 

Source Link

Usage

From source file:ajdtplugin.AjNaiveASTFlattener.java

License:Open Source License

public boolean visit(AfterThrowingAdviceDeclaration node) {

    instAftThrow = new AdviceAfterThrowing();
    instAftThrow.setAdviceTypeName(this.adviceType);

    List<String> param = new ArrayList<String>();
    printIndent();/*from   w  w w  .  j  a v a 2  s . c o  m*/

    this.buffer.append("after");
    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());
        instAftThrow.getParameterTypes().add(element.getType().toString());
        param.add(element.getName().toString());
        if (iter.hasNext())
            buffer.append(", ");
    }
    this.buffer.append(") throwing(");
    //throwing(Exception ex)
    node.getThrowing().accept(this);

    instAftThrow.ExceptionType = node.getThrowing().getType().toString();
    instAftThrow.ExceptionName = node.getThrowing().getName().toString();
    //      System.out.println(node.getThrowing().getType()+"*** "+ node.getThrowing().getName().toString());

    this.buffer.append("): ");

    instAftThrow.setPointcut((ReferencePointcut) node.getPointcut());
    instAftThrow.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;
}