1 25 package org.objectweb.easybeans.tests.common.ejbs.base.invocationcontext; 26 27 import java.lang.reflect.Method ; 28 29 import javax.interceptor.AroundInvoke; 30 import javax.interceptor.InvocationContext; 31 32 import org.objectweb.easybeans.log.JLog; 33 import org.objectweb.easybeans.log.JLogFactory; 34 import org.objectweb.easybeans.tests.common.helper.InvocationContextHelper; 35 import org.objectweb.easybeans.tests.common.interceptors.invocationcontext.ComplexObject00; 36 37 42 public class BaseInvocationParameter01 implements ItfInvocationParameter00{ 43 44 47 private JLog logger = JLogFactory.getLog(BaseInvocationParameter01.class); 48 49 56 @SuppressWarnings ("unused") 57 @AroundInvoke 58 private Object intercept(final InvocationContext ic) throws Exception { 59 Method mIC = ic.getMethod(); 60 61 if (mIC.toString().contains("getObjects00")){ 62 return InvocationContextHelper.setParametersNull(ic); 64 } else if (mIC.toString().contains("getObjects01")) { 65 return InvocationContextHelper.getParametersArray(ic); 67 } else if (mIC.toString().contains("getObjects02")) { 68 return InvocationContextHelper.modifyParameters(ic); 70 }else{ 71 throw new Exception ("Invalid method to intercept."); 72 } 73 } 74 75 82 public Object [] getObjects00(ComplexObject00 objCP) throws Exception { 83 Object [] arObjs = {objCP}; 84 logger.debug("after interceptors, parameters: {0}", objCP); 85 return arObjs; 86 } 87 88 95 public Object [] getObjects01(ComplexObject00 objCP) throws Exception { 96 Object [] arObjs = {objCP}; 97 logger.debug("after interceptors, parameters: {0}, {1}", objCP); 98 return arObjs; 99 } 100 101 108 public Object [] getObjects02(ComplexObject00 objCP) throws Exception { 109 Object [] arObjs = {objCP}; 110 logger.debug("after interceptors, parameters: {0}", objCP); 111 return arObjs; 112 } 113 114 } 115 | Popular Tags |