1 22 package org.jboss.aop; 23 24 import org.jboss.aop.joinpoint.Joinpoint; 25 import org.jboss.aop.joinpoint.MethodJoinpoint; 26 import org.jboss.aop.util.MethodHashing; 27 28 import java.lang.reflect.Method ; 29 import java.util.Arrays ; 30 31 34 public class MethodInfo extends JoinPointInfo 35 { 36 private Method advisedMethod; 37 private Method unadvisedMethod; 38 private long hash; 39 40 public MethodInfo() 41 { 42 } 43 44 public MethodInfo(Class clazz, long hash, long unadvisedHash, Advisor advisor) 45 { 46 super(advisor, clazz); 47 48 try 49 { 50 this.hash = hash; 51 advisedMethod = MethodHashing.findMethodByHash(clazz, hash); 52 unadvisedMethod = MethodHashing.findMethodByHash(clazz, unadvisedHash); 53 this.setAdvisor(advisor); 54 } 55 catch (Exception e) 56 { 57 throw new RuntimeException (e); 58 } 59 60 } 61 62 65 private MethodInfo(MethodInfo other) 66 { 67 super(other); 68 this.advisedMethod = other.advisedMethod; 69 this.unadvisedMethod = other.unadvisedMethod; 70 this.hash = other.hash; 71 } 72 73 protected Joinpoint internalGetJoinpoint() 74 { 75 return new MethodJoinpoint(advisedMethod); 76 } 77 78 public JoinPointInfo copy() 79 { 80 return new MethodInfo(this); 81 } 82 83 public Method getAdvisedMethod() 84 { 85 return advisedMethod; 86 } 87 88 public void setAdvisedMethod(Method advisedMethod) 89 { 90 this.advisedMethod = advisedMethod; 91 } 92 93 public long getHash() { 94 return hash; 95 } 96 97 public void setHash(long hash) 98 { 99 this.hash = hash; 100 } 101 102 public Method getUnadvisedMethod() 103 { 104 return unadvisedMethod; 105 } 106 107 public void setUnadvisedMethod(Method unadvisedMethod) { 108 this.unadvisedMethod = unadvisedMethod; 109 } 110 111 public String toString() 112 { 113 StringBuffer sb = new StringBuffer ("Method"); 114 sb.append("["); 115 sb.append("method=" + advisedMethod); 116 sb.append("]"); 117 return sb.toString(); 118 } 119 } 120 | Popular Tags |