1 4 package com.tc.aspectwerkz.joinpoint.impl; 5 6 import com.tc.aspectwerkz.joinpoint.MethodRtti; 7 import com.tc.aspectwerkz.joinpoint.Rtti; 8 9 import java.lang.ref.WeakReference ; 10 import java.lang.reflect.Method ; 11 12 17 public class MethodRttiImpl implements MethodRtti { 18 private static final Object [] EMPTY_OBJECT_ARRAY = new Object []{}; 19 20 private final MethodSignatureImpl m_signature; 21 22 private WeakReference m_thisRef; 23 24 private WeakReference m_targetRef; 25 26 private Object [] m_parameterValues = EMPTY_OBJECT_ARRAY; 27 28 private Object m_returnValue; 29 30 37 public MethodRttiImpl(final MethodSignatureImpl signature, final Object thisInstance, final Object targetInstance) { 38 m_signature = signature; 39 m_thisRef = new WeakReference (thisInstance); 40 m_targetRef = new WeakReference (targetInstance); 41 } 42 43 50 public Rtti cloneFor(final Object thisInstance, final Object targetInstance) { 51 return new MethodRttiImpl(m_signature, thisInstance, targetInstance); 52 } 53 54 59 public Object getTarget() { 60 return m_targetRef.get(); 61 } 62 63 68 public Object getThis() { 69 return m_thisRef.get(); 70 } 71 72 77 public Method getMethod() { 78 return m_signature.getMethod(); 79 } 80 81 86 public Class getDeclaringType() { 87 return m_signature.getDeclaringType(); 88 } 89 90 99 public int getModifiers() { 100 return m_signature.getModifiers(); 101 } 102 103 108 public String getName() { 109 return m_signature.getName(); 110 } 111 112 117 public Class [] getExceptionTypes() { 118 return m_signature.getExceptionTypes(); 119 } 120 121 126 public Class [] getParameterTypes() { 127 return m_signature.getParameterTypes(); 128 } 129 130 135 public void setParameterValues(final Object [] parameterValues) { 136 m_parameterValues = parameterValues; 137 } 138 139 144 public Object [] getParameterValues() { 145 return m_parameterValues; 146 } 147 148 153 public Class getReturnType() { 154 return m_signature.getReturnType(); 155 } 156 157 162 public void setReturnValue(final Object returnValue) { 163 m_returnValue = returnValue; 164 } 165 166 171 public Object getReturnValue() { 172 return m_returnValue; 173 } 174 175 181 public String toString() { 182 return super.toString(); 183 } 184 } | Popular Tags |