1 54 package org.logicalcobwebs.cglib.reflect; 55 56 import java.lang.reflect.InvocationTargetException ; 57 import java.lang.reflect.Method ; 58 59 public class FastMethod extends FastMember 60 { 61 FastMethod(FastClass fc, Method method) { 62 super(fc, method, helper(fc, method)); 63 } 64 65 private static int helper(FastClass fc, Method method) { 66 try { 67 return fc.getIndex(method.getName(), method.getParameterTypes()); 68 } catch (Error e) { 69 System.err.println("Caught error " + e + " LOOKING UP INDEX name=" + method.getName() + " types=" + java.util.Arrays.asList(method.getParameterTypes()) + " in class " + fc.getClass().getName()); 70 throw e; 71 } 72 } 73 74 public Class getReturnType() { 75 return ((Method )member).getReturnType(); 76 } 77 78 public Class [] getParameterTypes() { 79 return ((Method )member).getParameterTypes(); 80 } 81 82 public Class [] getExceptionTypes() { 83 return ((Method )member).getExceptionTypes(); 84 } 85 86 public Object invoke(Object obj, Object [] args) throws InvocationTargetException { 87 return fc.invoke(index, obj, args); 88 } 89 90 public Method getJavaMethod() { 91 return (Method )member; 92 } 93 } 94 | Popular Tags |