1 22 package org.jboss.aop.joinpoint; 23 24 import org.jboss.aop.Advisor; 25 import org.jboss.aop.metadata.MetaDataResolver; 26 import org.jboss.aop.metadata.SimpleMetaData; 27 28 import java.lang.reflect.Method ; 29 import java.util.Map ; 30 31 38 public class MethodInvocationWrapper extends MethodInvocation 39 { 40 private static final long serialVersionUID = 6399861718513077210L; 41 42 MethodInvocation wrapped; 43 44 public MethodInvocationWrapper(MethodInvocation wrapped, org.jboss.aop.advice.Interceptor[] interceptors) 45 { 46 super(interceptors); 47 this.wrapped = wrapped; 48 } 49 50 public Object getMetaData(Object group, Object attr) 51 { 52 return wrapped.getMetaData(group, attr); 53 } 54 55 public Object invokeNext() throws Throwable 56 { 57 if (interceptors != null && currentInterceptor < interceptors.length) 58 { 59 try 60 { 61 return interceptors[currentInterceptor++].invoke(this); 62 } 63 finally 64 { 65 currentInterceptor--; 67 } 68 } 69 try 70 { 71 return wrapped.invokeNext(); 72 } 73 finally 74 { 75 responseContextInfo = wrapped.getResponseContextInfo(); 76 } 77 } 78 79 public MetaDataResolver getInstanceResolver() 80 { 81 return wrapped.getInstanceResolver(); 82 } 83 84 public Object [] getArguments() 85 { 86 return wrapped.getArguments(); 87 } 88 89 public void setArguments(Object [] args) 90 { 91 wrapped.setArguments(args); 92 } 93 public Object getTargetObject() 94 { 95 return wrapped.getTargetObject(); 96 } 97 98 public Invocation copy() 99 { 100 MethodInvocationWrapper invocation = new MethodInvocationWrapper((MethodInvocation)wrapped.copy(), interceptors); 101 invocation.currentInterceptor = this.currentInterceptor; 102 return invocation; 103 } 104 105 public Method getMethod() 106 { 107 return wrapped.getMethod(); 108 } 109 110 public Method getActualMethod() 111 { 112 return wrapped.getActualMethod(); 113 } 114 115 public long getMethodHash() 116 { 117 return wrapped.getMethodHash(); 118 } 119 120 public Advisor getAdvisor() 121 { 122 return wrapped.getAdvisor(); 123 } 124 125 public Map getResponseContextInfo() 126 { 127 return wrapped.getResponseContextInfo(); 128 } 129 130 public void setResponseContextInfo(Map responseContextInfo) 131 { 132 wrapped.setResponseContextInfo(responseContextInfo); 133 } 134 135 public Object getResponseAttachment(Object key) 136 { 137 return wrapped.getResponseAttachment(key); 138 } 139 140 public void addResponseAttachment(Object key, Object val) 141 { 142 wrapped.addResponseAttachment(key, val); 143 } 144 145 public SimpleMetaData getMetaData() 146 { 147 return wrapped.getMetaData(); 148 } 149 150 public void setMetaData(SimpleMetaData data) 151 { 152 wrapped.setMetaData(data); 153 } 154 155 public void setTargetObject(Object targetObject) 156 { 157 wrapped.setTargetObject(targetObject); 158 } 159 160 } 161 | Popular Tags |