1 4 package com.tc.aspectwerkz.joinpoint.impl; 5 6 import java.lang.reflect.Method ; 7 import java.io.Serializable ; 8 9 14 public class MethodTuple implements Serializable { 15 private final Method m_wrapperMethod; 16 17 private final Method m_originalMethod; 18 19 private final Class m_declaringClass; 20 21 25 public MethodTuple(Method wrapperMethod, Method originalMethod) { 26 if (originalMethod == null) { 27 originalMethod = wrapperMethod; 28 } 29 if (wrapperMethod.getDeclaringClass() != originalMethod.getDeclaringClass()) { 30 throw new RuntimeException ( 31 wrapperMethod.getName() 32 + " and " 33 + originalMethod.getName() 34 + " does not have the same declaring class" 35 ); 36 } 37 m_declaringClass = wrapperMethod.getDeclaringClass(); 38 m_wrapperMethod = wrapperMethod; 39 m_wrapperMethod.setAccessible(true); 40 m_originalMethod = originalMethod; 41 m_originalMethod.setAccessible(true); 42 } 43 44 public boolean isWrapped() { 45 return m_originalMethod != null; 46 } 47 48 public Class getDeclaringClass() { 49 return m_declaringClass; 50 } 51 52 public Method getWrapperMethod() { 53 return m_wrapperMethod; 54 } 55 56 public Method getOriginalMethod() { 57 return m_originalMethod; 58 } 59 60 public String getName() { 61 return m_wrapperMethod.getName(); 62 } 63 } | Popular Tags |