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