1 8 package org.codehaus.aspectwerkz.joinpoint.impl; 9 10 import java.lang.reflect.Method ; 11 import java.io.Serializable ; 12 13 18 public class MethodTuple implements Serializable { 19 private final Method m_wrapperMethod; 20 21 private final Method m_originalMethod; 22 23 private final Class m_declaringClass; 24 25 29 public MethodTuple(Method wrapperMethod, Method originalMethod) { 30 if (originalMethod == null) { 31 originalMethod = wrapperMethod; 32 } 33 if (wrapperMethod.getDeclaringClass() != originalMethod.getDeclaringClass()) { 34 throw new RuntimeException ( 35 wrapperMethod.getName() 36 + " and " 37 + originalMethod.getName() 38 + " does not have the same declaring class" 39 ); 40 } 41 m_declaringClass = wrapperMethod.getDeclaringClass(); 42 m_wrapperMethod = wrapperMethod; 43 m_wrapperMethod.setAccessible(true); 44 m_originalMethod = originalMethod; 45 m_originalMethod.setAccessible(true); 46 } 47 48 public boolean isWrapped() { 49 return m_originalMethod != null; 50 } 51 52 public Class getDeclaringClass() { 53 return m_declaringClass; 54 } 55 56 public Method getWrapperMethod() { 57 return m_wrapperMethod; 58 } 59 60 public Method getOriginalMethod() { 61 return m_originalMethod; 62 } 63 64 public String getName() { 65 return m_wrapperMethod.getName(); 66 } 67 } | Popular Tags |