Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

InvocationJoinPointClosure.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*******************************************************************************
  2. * Copyright (c) 2004 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Common Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/cpl-v10.html
  7. *
  8. * Contributors:
  9. * IBM Corporation - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.aopalliance;
  12. import java.lang.reflect.AccessibleObject;
  13. import org.aopalliance.intercept.Invocation;
  14. import org.aspectj.lang.JoinPoint;
  15. import org.aspectj.lang.reflect.CodeSignature;
  16. import org.aspectj.lang.reflect.ConstructorSignature;
  17. import org.aspectj.lang.reflect.MethodSignature;
  18. public abstract class InvocationJoinPointClosure extends JoinPointClosure implements Invocation {
  19. public InvocationJoinPointClosure(JoinPoint jp) {
  20. super(jp);
  21. }
  22. /* (non-Javadoc)
  23. * @see org.aopalliance.intercept.Joinpoint#getStaticPart()
  24. */
  25. public AccessibleObject getStaticPart() {
  26. CodeSignature cSig = (CodeSignature)jp.getSignature();
  27. Class clazz = cSig.getDeclaringType();
  28. AccessibleObject ret = null;
  29. try {
  30. if (cSig instanceof MethodSignature) {
  31. ret = clazz.getMethod(cSig.getName(),cSig.getParameterTypes());
  32. } else if (cSig instanceof ConstructorSignature) {
  33. ret = clazz.getConstructor(cSig.getParameterTypes());
  34. }
  35. } catch (NoSuchMethodException mEx) {
  36. throw new UnsupportedOperationException(
  37. "Can't find member " + cSig.toLongString());
  38. }
  39. return ret;
  40. }
  41. /* (non-Javadoc)
  42. * @see org.aopalliance.intercept.Invocation#getArguments()
  43. */
  44. public Object[] getArguments() {
  45. return jp.getArgs();
  46. }
  47. }