1 13 14 15 package org.aspectj.runtime.reflect; 16 17 import java.lang.reflect.Method ; 18 19 import org.aspectj.lang.reflect.MethodSignature; 20 21 class MethodSignatureImpl extends CodeSignatureImpl implements MethodSignature { 22 private Method method; 23 Class returnType; 24 25 MethodSignatureImpl(int modifiers, String name, Class declaringType, 26 Class [] parameterTypes, String [] parameterNames, Class [] exceptionTypes, 27 Class returnType) 28 { 29 super(modifiers, name, declaringType, parameterTypes, parameterNames, 30 exceptionTypes); 31 this.returnType = returnType; 32 } 33 34 MethodSignatureImpl(String stringRep) { 35 super(stringRep); 36 } 37 38 39 public Class getReturnType() { 40 if (returnType == null) returnType = extractType(6); 41 return returnType; 42 } 43 44 protected String createToString(StringMaker sm) { 45 StringBuffer buf = new StringBuffer (); 46 buf.append(sm.makeModifiersString(getModifiers())); 47 if (sm.includeArgs) buf.append(sm.makeTypeName(getReturnType())); 48 if (sm.includeArgs) buf.append(" "); 49 buf.append(sm.makePrimaryTypeName(getDeclaringType(),getDeclaringTypeName())); 50 buf.append("."); 51 buf.append(getName()); 52 sm.addSignature(buf, getParameterTypes()); 53 sm.addThrows(buf, getExceptionTypes()); 54 return buf.toString(); 55 } 56 57 60 public Method getMethod() { 61 if (method == null) { 62 try { 63 method = getDeclaringType().getDeclaredMethod(getName(),getParameterTypes()); 64 } catch (NoSuchMethodException nsmEx) { 65 ; } 67 } 68 return method; 69 } 70 } 71 | Popular Tags |