You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AdviceSignatureImpl.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* *******************************************************************
  2. * Copyright (c) 1999-2001 Xerox Corporation,
  3. * 2002 Palo Alto Research Center, Incorporated (PARC).
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Common Public License v1.0
  7. * which accompanies this distribution and is available at
  8. * http://www.eclipse.org/legal/cpl-v10.html
  9. *
  10. * Contributors:
  11. * Xerox/PARC initial implementation
  12. * ******************************************************************/
  13. package org.aspectj.runtime.reflect;
  14. import org.aspectj.lang.reflect.AdviceSignature;
  15. class AdviceSignatureImpl extends CodeSignatureImpl implements AdviceSignature {
  16. Class returnType;
  17. AdviceSignatureImpl(int modifiers, String name, Class declaringType,
  18. Class[] parameterTypes, String[] parameterNames, Class[] exceptionTypes,
  19. Class returnType)
  20. {
  21. super(modifiers, name, declaringType, parameterTypes, parameterNames,
  22. exceptionTypes);
  23. this.returnType = returnType;
  24. }
  25. AdviceSignatureImpl(String stringRep) {
  26. super(stringRep);
  27. }
  28. /* name is consistent with reflection API
  29. before and after always return Void.TYPE
  30. (some around also return Void.Type) */
  31. public Class getReturnType() {
  32. if (returnType == null) returnType = extractType(6);
  33. return returnType;
  34. }
  35. String toString(StringMaker sm) {
  36. //XXX this signature needs a lot of work
  37. StringBuffer buf = new StringBuffer("ADVICE: ");
  38. buf.append(sm.makeModifiersString(getModifiers()));
  39. if (sm.includeArgs) buf.append(sm.makeTypeName(getReturnType()));
  40. if (sm.includeArgs) buf.append(" ");
  41. buf.append(sm.makePrimaryTypeName(getDeclaringType()));
  42. buf.append(".");
  43. buf.append(getName());
  44. sm.addSignature(buf, getParameterTypes());
  45. sm.addThrows(buf, getExceptionTypes());
  46. return buf.toString();
  47. }
  48. }