JavaTM 2 Platform
Std. Ed. v1.3.1

com.apple.mrj.jdirect
Class MethodClosure

java.lang.Object
  |
  +--com.apple.mrj.jdirect.MethodClosure

public class MethodClosure
extends Object

A MethodClosure is a thunk which enables a shared library to call into Java.
The MethodClosure constructor is given the object, method, and signature of the method to be called. The method getProc() returns a C function pointer that can be called by a shared library to invoke the specified java method.


Field Summary
static boolean DONT_MAINTAIN_CARBONLOCK
           
static boolean MAINTAIN_CARBONLCOK
           
 
Constructor Summary
protected MethodClosure(Object targetObject, String methodName, String methodSignature)
           
protected MethodClosure(Object targetObject, String methodName, String methodSignature, boolean unlockAroundClosure)
          Constructs a closure thunk that C code can call to invoke a particular method on a particular object.
 
Method Summary
 void dispose()
          You must maintain a reference to this object and call the dispose method when you want the closure thunk in the app's heap to be freed.
 int getProc()
          Returns a C function pointer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAINTAIN_CARBONLCOK

public static final boolean MAINTAIN_CARBONLCOK

DONT_MAINTAIN_CARBONLOCK

public static final boolean DONT_MAINTAIN_CARBONLOCK
Constructor Detail

MethodClosure

protected MethodClosure(Object targetObject,
                        String methodName,
                        String methodSignature)

MethodClosure

protected MethodClosure(Object targetObject,
                        String methodName,
                        String methodSignature,
                        boolean unlockAroundClosure)
Constructs a closure thunk that C code can call to invoke a particular method on a particular object. The closure allocates a small block of memory in the application's MacOS heap. The closure also maintains a reference to targetObject to prevent it from being garbage collected.
Parameters:
targetObject - the object whose method will be called (cannot be this).
methodName - the name of the method to be called
methodSignature - the signature (e.g. "(II)V") of the method to be called
Method Detail

dispose

public void dispose()
You must maintain a reference to this object and call the dispose method when you want the closure thunk in the app's heap to be freed.

getProc

public int getProc()
Returns a C function pointer
Returns:
an int which can be passed to a shared library and cast to a C function pointer

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.