1 22 package org.jboss.aop.joinpoint; 23 24 import org.jboss.aop.FieldInfo; 25 import org.jboss.aop.advice.Interceptor; 26 27 import java.lang.reflect.Field ; 28 29 30 38 public class FieldReadInvocation extends FieldInvocation 39 { 40 private static final long serialVersionUID = 3337041720097890861L; 41 42 public FieldReadInvocation(Field field, int index, Interceptor[] interceptors) 43 { 44 super(field, index, interceptors); 45 } 46 47 protected FieldReadInvocation(Interceptor[] interceptors) 48 { 49 super(interceptors); 50 } 51 52 protected FieldReadInvocation(FieldInfo info, Interceptor[] interceptors) 53 { 54 super(info, interceptors); 55 } 56 57 62 public Object invokeNext() throws Throwable 63 { 64 if (interceptors != null && currentInterceptor < interceptors.length) 65 { 66 try 67 { 68 return interceptors[currentInterceptor++].invoke(this); 69 } 70 finally 71 { 72 currentInterceptor--; 74 } 75 } 76 77 return invokeTarget(); 78 } 79 80 84 public Object invokeTarget() throws Throwable 85 { 86 return field.get(getTargetObject()); 87 } 88 89 97 public Invocation getWrapper(Interceptor[] newchain) 98 { 99 FieldReadInvocationWrapper wrapper = new FieldReadInvocationWrapper(this, newchain); 100 return wrapper; 101 } 102 103 107 public Invocation copy() 108 { 109 FieldReadInvocation wrapper = new FieldReadInvocation(field, index, interceptors); 110 wrapper.setAdvisor(this.getAdvisor()); 111 wrapper.setTargetObject(this.getTargetObject()); 112 wrapper.currentInterceptor = this.currentInterceptor; 113 wrapper.metadata = this.metadata; 114 wrapper.instanceResolver = this.instanceResolver; 115 return wrapper; 116 } 117 } 118 | Popular Tags |