1 8 package org.codehaus.aspectwerkz.joinpoint.impl; 9 10 import org.codehaus.aspectwerkz.joinpoint.MethodRtti; 11 import org.codehaus.aspectwerkz.joinpoint.Rtti; 12 13 import java.lang.ref.WeakReference ; 14 import java.lang.reflect.Method ; 15 16 21 public class MethodRttiImpl implements MethodRtti { 22 private static final Object [] EMPTY_OBJECT_ARRAY = new Object []{}; 23 24 private final MethodSignatureImpl m_signature; 25 26 private WeakReference m_thisRef; 27 28 private WeakReference m_targetRef; 29 30 private Object [] m_parameterValues = EMPTY_OBJECT_ARRAY; 31 32 private Object m_returnValue; 33 34 41 public MethodRttiImpl(final MethodSignatureImpl signature, final Object thisInstance, final Object targetInstance) { 42 m_signature = signature; 43 m_thisRef = new WeakReference (thisInstance); 44 m_targetRef = new WeakReference (targetInstance); 45 } 46 47 54 public Rtti cloneFor(final Object thisInstance, final Object targetInstance) { 55 return new MethodRttiImpl(m_signature, thisInstance, targetInstance); 56 } 57 58 63 public Object getTarget() { 64 return m_targetRef.get(); 65 } 66 67 72 public Object getThis() { 73 return m_thisRef.get(); 74 } 75 76 81 public Method getMethod() { 82 return m_signature.getMethod(); 83 } 84 85 90 public Class getDeclaringType() { 91 return m_signature.getDeclaringType(); 92 } 93 94 103 public int getModifiers() { 104 return m_signature.getModifiers(); 105 } 106 107 112 public String getName() { 113 return m_signature.getName(); 114 } 115 116 121 public Class [] getExceptionTypes() { 122 return m_signature.getExceptionTypes(); 123 } 124 125 130 public Class [] getParameterTypes() { 131 return m_signature.getParameterTypes(); 132 } 133 134 139 public void setParameterValues(final Object [] parameterValues) { 140 m_parameterValues = parameterValues; 141 } 142 143 148 public Object [] getParameterValues() { 149 return m_parameterValues; 150 } 151 152 157 public Class getReturnType() { 158 return m_signature.getReturnType(); 159 } 160 161 166 public void setReturnValue(final Object returnValue) { 167 m_returnValue = returnValue; 168 } 169 170 175 public Object getReturnValue() { 176 return m_returnValue; 177 } 178 179 185 public String toString() { 186 return super.toString(); 187 } 188 } | Popular Tags |