1 22 package org.jboss.aop.advice; 23 24 import org.jboss.aop.joinpoint.Invocation; 25 import org.jboss.aop.pointcut.CFlowMatcher; 26 import org.jboss.aop.pointcut.ast.ASTCFlowExpression; 27 28 35 public class CFlowInterceptor implements Interceptor 36 { 37 Interceptor[] chain; 38 ASTCFlowExpression expr; 39 String cflowString; 40 41 public CFlowInterceptor(String cflowString, ASTCFlowExpression expr, Interceptor[] chain) 42 { 43 this.chain = chain; 44 this.expr = expr; 45 this.cflowString = cflowString; 46 } 47 public String getName() 48 { 49 return "CFlowInterceptor"; 50 } 51 52 public String getCFlowString() 53 { 54 return cflowString; 55 } 56 57 public Object invoke(Invocation invocation) throws Throwable 58 { 59 if (new CFlowMatcher().matches(expr, invocation)) 60 { 61 Invocation wrapper = invocation.getWrapper(chain); 62 return wrapper.invokeNext(); 63 } 64 return invocation.invokeNext(); 66 } 67 } 68 | Popular Tags |