List of usage examples for org.aspectj.org.eclipse.jdt.core.dom AfterThrowingAdviceDeclaration getThrowing
public SingleVariableDeclaration getThrowing()
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 ww w. j av a 2s . com 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; }
From source file:org.eclipse.ajdt.core.dom.rewrite.AjASTRewriteAnalyzer.java
License:Open Source License
public boolean visit(AfterThrowingAdviceDeclaration node) { // ajh02: method added if (!hasChildrenChanges(node)) { return doVisitUnchangedChildren(node); }/*from w w w. j av a 2s. co m*/ int pos = rewriteJavadoc(node, AfterThrowingAdviceDeclaration.throwingJAVADOC_PROPERTY); // pointcut pos = rewriteRequiredNode(node, AfterThrowingAdviceDeclaration.throwingPOINTCUT_PROPERTY); // parameters try { if (isChanged(node, AfterThrowingAdviceDeclaration.throwingPARAMETERS_PROPERTY)) { pos = getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameLPAREN, pos); pos = rewriteNodeList(node, AfterThrowingAdviceDeclaration.throwingPARAMETERS_PROPERTY, pos, "", //$NON-NLS-1$ ", "); //$NON-NLS-1$ } else { pos = doVisit(node, AfterThrowingAdviceDeclaration.throwingPARAMETERS_PROPERTY, pos); } pos = getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameRPAREN, pos); if (node.getThrowing() != null) { pos = rewriteRequiredNode(node, AfterThrowingAdviceDeclaration.throwingTHROWING_PROPERTY); } pos = rewriteNodeList(node, AfterThrowingAdviceDeclaration.throwingTHROWN_EXCEPTIONS_PROPERTY, pos, " throws ", ", "); //$NON-NLS-1$ //$NON-NLS-2$ rewriteAdviceBody(node, pos); } catch (CoreException e) { // ignore } return false; }