Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: Bootstrap/MethodInvocation.java


1   // MethodInvocation.java, created Sun Mar 11  2:21:10 2001 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package Bootstrap;
5   
6   import java.lang.reflect.InvocationTargetException;
7   
8   import Clazz.jq_Method;
9   import Run_Time.Reflection;
10  
11  /**
12   * MethodInvocation
13   *
14   * @author  John Whaley <jwhaley@alum.mit.edu>
15   * @version $Id: MethodInvocation.java,v 1.6 2003/05/12 10:04:52 joewhaley Exp $
16   */
17  public class MethodInvocation {
18  
19      jq_Method method;
20      Object[] args;
21      
22      public MethodInvocation(jq_Method m, Object[] a) {
23          this.method = m;
24          this.args = a;
25      }
26  
27      public long invoke() throws Throwable {
28          try {
29              return Reflection.invoke(method, null, args);
30          } catch (InvocationTargetException x) {
31              throw x.getTargetException();
32          }
33      }
34      
35      public String toString() {
36          return "method "+method;
37      }
38  }