| java.lang.Object jsint.Invoke
Invoke | public class Invoke (Code) | | Provides dynamic Java method invocation through Java's Reflection
interface. For a good discussion of a Scheme implementation, and
the issues involved with dynamic method invocation in Java see:
Michael Travers, Java Q & A, Dr. Dobb's Journal, Jan., 2000,
p. 103-112.
Primitive types are not widened because it would make method
selection more ambiguous. By memoizing constructorTable() and
methodTable() dynamic method lookup can be done without consing.
You'll notice that Java doesn't make this very easy. For
example it would be nice if Method and Constructor shared an
Invokable interface.
Privileged methods can be invoked if the JVM allows it.
The name of a method to be invoked can be any nonnull Object
with a .toString() that names a method. It should probably be
changed to String.
|
Method Summary | |
public static Object[] | constructorTable(String c, boolean isPrivileged) Return the constructor table for the named class. | public static Object[] | constructorTable0(String c) | public static Object[] | constructorTable0Priv(String c) | public static Constructor | findConstructor(Object target, Pair types) Look up a particular constructor given its name, and the name of its
declaring class, and a list of argument type names. | public static Object | findMethod(Object[] methods, Object[] args) Find the most applicable method. | public static Method | findMethod(String name, Object target, Pair types) Look up a particular method given its name, and the name of its
declaring class, and a list of argument type names. | static Object | findMethodNoOpt(Object[] methods, Object[] args) | public static Object[] | getCachedMethodTable(Class c, String name, boolean isStatic) | public static Hashtable | getClassTable(String name, boolean isStatic) Returns a Class -> prameter[]/method array for the method named
name. | public static Method[] | getMethods(Class c, boolean isPrivileged) Return all the methods for this class. | public static Object | invokeConstructor(String c, Object[] args) | public static Object | invokeInstance(Object target, String name, Object[] args, boolean isPrivileged) | public static Object | invokeMethod(Class c, Object target, String name, Object[] args, boolean isStatic, boolean isPrivileged) | public static Object | invokeRawConstructor(Constructor m, Object[] args) | public static Object | invokeRawMethod(Method m, Object target, Object[] args) | public static Object | invokeStatic(Class c, String name, Object[] args) | public static boolean | isApplicable(Class[] types, Object[] args) | static Object[] | makeAccessible(Object[] items) Items should be of type AccessibleObject[] but we can't say that
on JVM's older than JDK 1.2
Also used by JavaField. | public static Object[] | methodTable(Class c, String name, boolean isStatic, boolean isPrivileged) | public static Object[] | methodTable0(Class c, String name, boolean isStatic, boolean isPrivileged) | public static Object[] | methodTableLookup(Class c, String name, boolean isStatic, boolean isPrivileged) | public static Object[] | methodTableLookupInstance(Class c, String name) | public static Object[] | methodTableLookupInstance(Class c, String name, boolean isPrivileged) | public static Object[] | methodTableLookupStatic(Class c, String name, boolean isPrivileged) | public static Vector | methodVector(Class c, String name) | public static Vector | methodVector(Class c, String name, boolean isPrivileged) | public static Vector | methodVectorMerge(Class c, String name, Vector result) Add new methods to your superclasses table. | public static Vector | methodVectorMerge(Class c, String name, Vector result, boolean isPrivileged) | public static boolean | parameterTypesMatch(Class[] p1, Class[] p2) | public static Object | peek(Object target, String name) | public static Object | peekStatic(Class c, String name) | public static Object | poke(Object target, String name, Object value) | public static Object | pokeStatic(Class c, String name, Object value) | public static void | putCachedMethodTable(Class c, String name, boolean isStatic, Object value) | public static Class[] | toClassArray(Pair types, int n) |
ALLOW_PRIVATE_ACCESS | final static boolean ALLOW_PRIVATE_ACCESS(Code) | | In some situations you may not be able to get declared methods.
We only try once.
|
BUCKET_SIZE | final public static int BUCKET_SIZE(Code) | | Each bucket in an method table contains a Class[] of
parameterTypes and the corresponding method or constructor. *
|
SETACCESSIBLE | static Method SETACCESSIBLE(Code) | | Check that this JVM has AccessibleObject.
We only try once.
|
constructorCachePriv | final public static Hashtable constructorCachePriv(Code) | | |
instanceCache | final public static Hashtable instanceCache(Code) | | Instance method name -> Class -> parameter[]/method array. *
|
staticCache | final public static Hashtable staticCache(Code) | | Static method name -> Class -> parameter[]/method array. *
|
constructorTable | public static Object[] constructorTable(String c, boolean isPrivileged)(Code) | | Return the constructor table for the named class. *
|
findConstructor | public static Constructor findConstructor(Object target, Pair types)(Code) | | Look up a particular constructor given its name, and the name of its
declaring class, and a list of argument type names.
This is only used by (constructor).
|
findMethod | public static Object findMethod(Object[] methods, Object[] args)(Code) | | Find the most applicable method. For instance methods
getMethods() has already handled the "this" argument, so
instance and static methods are matched the same way. *
|
findMethod | public static Method findMethod(String name, Object target, Pair types)(Code) | | Look up a particular method given its name, and the name of its
declaring class, and a list of argument type names.
This is only used by (method).
|
getClassTable | public static Hashtable getClassTable(String name, boolean isStatic)(Code) | | Returns a Class -> prameter[]/method array for the method named
name. *
|
getMethods | public static Method[] getMethods(Class c, boolean isPrivileged)(Code) | | Return all the methods for this class. If you can't get all, for
some reason,, just return the public ones.
Memoizable.
|
makeAccessible | static Object[] makeAccessible(Object[] items)(Code) | | Items should be of type AccessibleObject[] but we can't say that
on JVM's older than JDK 1.2
Also used by JavaField.
|
methodTable0 | public static Object[] methodTable0(Class c, String name, boolean isStatic, boolean isPrivileged)(Code) | | |
methodTableLookup | public static Object[] methodTableLookup(Class c, String name, boolean isStatic, boolean isPrivileged)(Code) | | |
methodTableLookupInstance | public static Object[] methodTableLookupInstance(Class c, String name, boolean isPrivileged)(Code) | | |
methodTableLookupStatic | public static Object[] methodTableLookupStatic(Class c, String name, boolean isPrivileged)(Code) | | |
parameterTypesMatch | public static boolean parameterTypesMatch(Class[] p1, Class[] p2)(Code) | | Do the paramter types of an instance method match? *
|
putCachedMethodTable | public static void putCachedMethodTable(Class c, String name, boolean isStatic, Object value)(Code) | | |
|
|