1 25 26 package org.objectweb.easybeans.examples.statelessbean; 27 28 import java.lang.reflect.Method ; 29 30 import javax.interceptor.AroundInvoke; 31 import javax.interceptor.InvocationContext; 32 33 34 38 public class StatelessOnlyAddMethodInterceptor { 39 40 46 @AroundInvoke 47 public Object onlyAdd(final InvocationContext invocationContext) throws Exception { 48 System.out.println("Add interceptor"); 49 Method m = invocationContext.getMethod(); 50 if (m.getName().equals("add")) { 52 System.out.println("Applied on the correct method"); 53 } else { 54 throw new Exception ("Error, should be only on add method while it is applied on '" + m.getName() + "' method."); 55 } 56 return invocationContext.proceed(); 57 } 58 59 } 60 | Popular Tags |