1 22 package org.jboss.aop; 23 24 import java.lang.reflect.Constructor ; 25 import java.lang.reflect.Method ; 26 27 import org.jboss.aop.advice.Interceptor; 28 import org.jboss.aop.joinpoint.Joinpoint; 29 import org.jboss.aop.joinpoint.MethodCalledByConstructorJoinpoint; 30 31 36 public class MethodByConInfo extends CallerMethodInfo 37 { 38 39 private final int callingIndex; 40 private final Constructor calling; 41 42 public MethodByConInfo(Advisor advisor, Class calledClass, int callingIndex, Method m, long calledMethodHash, Interceptor[] in) 43 { 44 super(advisor, calledClass, m, calledMethodHash, in, advisor.getClazz()); 46 this.callingIndex = callingIndex; 47 calling = advisor.constructors[callingIndex]; 48 } 49 50 53 private MethodByConInfo(MethodByConInfo other) 54 { 55 super(other); 56 this.callingIndex = other.callingIndex; 57 this.calling = other.calling; 58 } 59 60 protected Joinpoint internalGetJoinpoint() 61 { 62 return new MethodCalledByConstructorJoinpoint(calling, getMethod()); 63 } 64 65 public JoinPointInfo copy() 66 { 67 return new MethodByConInfo(this); 68 } 69 70 public String toString() 71 { 72 StringBuffer sb = new StringBuffer ("Method called by Constructor"); 73 sb.append("["); 74 sb.append("calling=" + calling); 75 sb.append(",called=" + getMethod()); 76 sb.append("]"); 77 return sb.toString(); 78 } 79 80 public int getCallingIndex() 81 { 82 return callingIndex; 83 } 84 85 public Constructor getCalling() 86 { 87 return calling; 88 } 89 } 90 | Popular Tags |