1 4 package com.tc.aspectwerkz.transform.inlining; 5 6 import com.tc.asm.Label; 7 8 import com.tc.aspectwerkz.joinpoint.management.JoinPointType; 9 import com.tc.aspectwerkz.transform.InstrumentationContext; 10 11 23 public final class EmittedJoinPoint { 24 25 public final static Label NO_LINE_NUMBER = new Label(); 26 27 private final int joinPointType; 28 private final String callerClassName; 29 private final String callerMethodName; 30 private final String callerMethodDesc; 31 private final int callerMethodModifiers; 32 private final String calleeClassName; 33 private final String calleeMemberName; 34 private final String calleeMemberDesc; 35 private final int calleeMemberModifiers; 36 private final int joinPointHash; 37 private final String joinPointClassName; 38 private final Label lineNumberLabel; 39 40 44 private int lineNumber = 0; 45 46 62 public EmittedJoinPoint(final int joinPointType, 63 final String callerClassName, 64 final String callerMethodName, 65 final String callerMethodDesc, 66 final int callerMethodModifiers, 67 final String calleeClassName, 68 final String calleeMemberName, 69 final String calleeMemberDesc, 70 final int calleeMemberModifiers, 71 final int joinPointHash, 72 final String joinPointClassName, 73 final Label lineNumberLabel) { 74 this.joinPointType = joinPointType; 75 this.callerClassName = callerClassName; 76 this.callerMethodName = callerMethodName; 77 this.callerMethodDesc = callerMethodDesc; 78 this.callerMethodModifiers = callerMethodModifiers; 79 this.calleeClassName = calleeClassName; 80 this.calleeMemberName = calleeMemberName; 81 this.calleeMemberDesc = calleeMemberDesc; 82 this.calleeMemberModifiers = calleeMemberModifiers; 83 this.joinPointHash = joinPointHash; 84 this.joinPointClassName = joinPointClassName; 85 this.lineNumberLabel = lineNumberLabel; 86 } 87 88 103 public EmittedJoinPoint(final int joinPointType, 104 final String callerClassName, 105 final String callerMethodName, 106 final String callerMethodDesc, 107 final int callerMethodModifiers, 108 final String calleeClassName, 109 final String calleeMemberName, 110 final String calleeMemberDesc, 111 final int calleeMemberModifiers, 112 final int joinPointHash, 113 final String joinPointClassName) { 114 this(joinPointType, callerClassName, callerMethodName, callerMethodDesc, callerMethodModifiers, 115 calleeClassName, calleeMemberName, calleeMemberDesc, calleeMemberModifiers, 116 joinPointHash, joinPointClassName, NO_LINE_NUMBER 117 ); 118 } 119 120 public int getJoinPointType() { 121 return joinPointType; 122 } 123 124 public String getCallerClassName() { 125 return callerClassName; 126 } 127 128 public String getCallerMethodName() { 129 return callerMethodName; 130 } 131 132 public String getCallerMethodDesc() { 133 return callerMethodDesc; 134 } 135 136 public int getCallerMethodModifiers() { 137 return callerMethodModifiers; 138 } 139 140 public String getCalleeClassName() { 141 return calleeClassName; 142 } 143 144 public String getCalleeMemberName() { 145 return calleeMemberName; 146 } 147 148 public String getCalleeMemberDesc() { 149 return calleeMemberDesc; 150 } 151 152 public int getCalleeMemberModifiers() { 153 return calleeMemberModifiers; 154 } 155 156 public int getJoinPointHash() { 157 return joinPointHash; 158 } 159 160 public String getJoinPointClassName() { 161 return joinPointClassName; 162 } 163 164 public int getLineNumber() { 165 return lineNumber; 166 } 167 168 public void resolveLineNumber(InstrumentationContext context) { 169 lineNumber = context.resolveLineNumberInfo(lineNumberLabel); 170 } 171 172 public boolean equals(Object o) { 173 if (this == o) { 174 return true; 175 } 176 if (!(o instanceof EmittedJoinPoint)) { 177 return false; 178 } 179 180 final EmittedJoinPoint emittedJoinPoint = (EmittedJoinPoint) o; 181 182 if (calleeMemberModifiers != emittedJoinPoint.calleeMemberModifiers) { 183 return false; 184 } 185 if (callerMethodModifiers != emittedJoinPoint.callerMethodModifiers) { 186 return false; 187 } 188 if (joinPointHash != emittedJoinPoint.joinPointHash) { 189 return false; 190 } 191 if (joinPointType != emittedJoinPoint.joinPointType) { 192 return false; 193 } 194 if (!calleeClassName.equals(emittedJoinPoint.calleeClassName)) { 195 return false; 196 } 197 if (!calleeMemberDesc.equals(emittedJoinPoint.calleeMemberDesc)) { 198 return false; 199 } 200 if (!calleeMemberName.equals(emittedJoinPoint.calleeMemberName)) { 201 return false; 202 } 203 if (!callerClassName.equals(emittedJoinPoint.callerClassName)) { 204 return false; 205 } 206 if (!callerMethodDesc.equals(emittedJoinPoint.callerMethodDesc)) { 207 return false; 208 } 209 if (!callerMethodName.equals(emittedJoinPoint.callerMethodName)) { 210 return false; 211 } 212 if (!joinPointClassName.equals(emittedJoinPoint.joinPointClassName)) { 213 return false; 214 } 215 216 return true; 217 } 218 219 public int hashCode() { 220 int result; 221 result = joinPointType; 222 result = 29 * result + callerClassName.hashCode(); 223 result = 29 * result + callerMethodName.hashCode(); 224 result = 29 * result + callerMethodDesc.hashCode(); 225 result = 29 * result + callerMethodModifiers; 226 result = 29 * result + calleeClassName.hashCode(); 227 result = 29 * result + calleeMemberName.hashCode(); 228 result = 29 * result + calleeMemberDesc.hashCode(); 229 result = 29 * result + calleeMemberModifiers; 230 result = 29 * result + joinPointHash; 231 result = 29 * result + joinPointClassName.hashCode(); 232 return result; 233 } 234 235 public String toString() { 236 StringBuffer sb = new StringBuffer (); 237 sb.append(JoinPointType.fromInt(getJoinPointType()).toString()); 238 sb.append(" , caller "); 239 sb.append(getCallerClassName()); 240 sb.append('.').append(getCallerMethodName()); 241 sb.append(getCallerMethodDesc()); 242 sb.append(" , callee "); 243 sb.append(getCalleeClassName()); 244 sb.append('.').append(getCalleeMemberName()); 245 sb.append(' ').append(getCalleeMemberDesc()); 246 sb.append(" , line ").append(getLineNumber()); 247 return sb.toString(); 248 } 249 } | Popular Tags |