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

Quick Search    Search Deep

silk
Class JavaMethod  view JavaMethod download JavaMethod.java

java.lang.Object
  extended bysilk.Procedure
      extended bysilk.JavaMethod
All Implemented Interfaces:
java.lang.Runnable

public class JavaMethod
extends Procedure

This class allows you to call any Java method, just by naming it, and doing the dispatch at runtime.


Field Summary
private  boolean isSpecific
           
private  boolean isStatic
           
private  java.lang.Class methodClass
           
private  Symbol methodName
           
private  java.lang.Object[] methodTable
           
 
Fields inherited from class silk.Procedure
maxArgs, minArgs, name
 
Constructor Summary
JavaMethod(java.lang.String name, java.lang.Class c)
           
JavaMethod(java.lang.String name, java.lang.Class c, boolean isStatic)
          If the method is static then Class c is not null.
 
Method Summary
 java.lang.Object apply(java.lang.Object[] args)
          Apply the method to a list of arguments.
 boolean isStatic()
          Is this methodclass specified?
 
Methods inherited from class silk.Procedure
apply, makeArgArray, makeArgArray, nParms, run, setName, throwObject, throwRuntimeException, toString, toStringArgs, tryCatch, tryFinally
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

methodName

private Symbol methodName

methodClass

private java.lang.Class methodClass

methodTable

private java.lang.Object[] methodTable

isStatic

private boolean isStatic

isSpecific

private boolean isSpecific
Constructor Detail

JavaMethod

public JavaMethod(java.lang.String name,
                  java.lang.Class c,
                  boolean isStatic)
If the method is static then Class c is not null. For instance methods, if Class c is not null, then it is used at construct time to create a method table. Otherwise, the class of the method is determined at call time from the target, and the method table is constructed then and cached. Examples:
      new JavaMethod("getProperties", System.class, true) - static method
      new JavaMethod("put", Hashtable.class,false)        - specific instance method.
      new JavaMethod("put", null, false)                  - unspecified instance method
      


JavaMethod

public JavaMethod(java.lang.String name,
                  java.lang.Class c)
Method Detail

isStatic

public boolean isStatic()
Is this methodclass specified?


apply

public java.lang.Object apply(java.lang.Object[] args)
Apply the method to a list of arguments.

Specified by:
apply in class Procedure