1 7 package org.jboss.jms.container; 8 9 import java.lang.reflect.InvocationTargetException ; 10 11 import org.jboss.aop.advice.Interceptor; 12 import org.jboss.aop.joinpoint.Invocation; 13 import org.jboss.aop.joinpoint.MethodInvocation; 14 15 21 public class DispatchInterceptor 22 implements Interceptor 23 { 24 26 28 29 private Object target; 30 31 33 35 40 public DispatchInterceptor(Object target) 41 { 42 this.target = target; 43 } 44 45 47 49 public String getName() 50 { 51 return "DispatchInterceptor"; 52 } 53 54 public Object invoke(Invocation invocation) throws Throwable 55 { 56 MethodInvocation mi = (MethodInvocation) invocation; 57 try 58 { 59 return mi.getMethod().invoke(target, mi.getArguments()); 60 } 61 catch (Throwable t) 62 { 63 if (t instanceof InvocationTargetException ) 64 throw ((InvocationTargetException ) t).getTargetException(); 65 throw t; 66 } 67 } 68 69 71 73 75 77 } 78 | Popular Tags |