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.ConstructorCalledByMethodJoinpoint; 29 import org.jboss.aop.joinpoint.Joinpoint; 30 import org.jboss.aop.util.MethodHashing; 31 32 37 public class ConByMethodInfo extends CallerConstructorInfo 38 { 39 private final long callingMethodHash; 40 private final Method callingMethod; 41 42 48 public ConByMethodInfo(Advisor advisor, Class calledClass, long callingMethodHash, Constructor c, long calledConHash, Method wrappingMethod, Interceptor[] in) 49 { 50 super(advisor, calledClass, c, calledConHash, wrappingMethod, in, advisor.getClazz()); 52 try 53 { 54 this.callingMethodHash = callingMethodHash; 55 callingMethod = MethodHashing.findMethodByHash(getCallingClass(), callingMethodHash); 56 } 57 catch (Exception e) 58 { 59 throw new RuntimeException (e); 60 } 61 } 62 63 66 protected ConByMethodInfo(ConByMethodInfo other) 67 { 68 super(other); 69 this.callingMethodHash = other.callingMethodHash; 70 this.callingMethod = other.callingMethod; 71 } 72 73 protected Joinpoint internalGetJoinpoint() 74 { 75 return new ConstructorCalledByMethodJoinpoint(callingMethod, getConstructor()); 76 } 77 78 public JoinPointInfo copy() 79 { 80 return new ConByMethodInfo(this); 81 } 82 83 public String toString() 84 { 85 StringBuffer sb = new StringBuffer ("Constructor called by Method"); 86 sb.append("["); 87 sb.append("calling=" + callingMethod); 88 sb.append(",called=" + getConstructor()); 89 sb.append("]"); 90 return sb.toString(); 91 } 92 93 public long getCallingMethodHash() 94 { 95 return callingMethodHash; 96 } 97 98 public Method getCallingMethod() 99 { 100 return callingMethod; 101 } 102 } 103 | Popular Tags |