|
Jni::org::qore::jni::Class | Jni::org::qore::jni::define_class (string name, binary bytecode) |
| Creates a class object from bytecode data. More...
|
|
string | Jni::org::qore::jni::get_version () |
| Returns the version of the JNI API. More...
|
|
Jni::java::lang::Object | Jni::org::qore::jni::implement_interface (Jni::org::qore::jni::QoreInvocationHandler invocationHandler, Jni::java::lang::Class cls) |
| Creates a Java object that implements given interface using an invocation handler. More...
|
|
Jni::java::lang::Object | Jni::org::qore::jni::implement_interface (Jni::java::lang::ClassLoader classLoader, Jni::org::qore::jni::QoreInvocationHandler invocationHandler, Jni::java::lang::Class cls) |
| Creates a Java object that implements given interface using an invocation handler using an explicit class loader. More...
|
|
Jni::java::lang::Object | Jni::org::qore::jni::invoke (Jni::java::lang::reflect::Method method, *Jni::java::lang::Object object,...) |
| Invokes a method with the given arguments in a virtual way; meaning that the method in the most derived class is executed; not necessarily the method passed as an argument. More...
|
|
Jni::java::lang::Object | Jni::org::qore::jni::invoke_nonvirtual (Jni::java::lang::reflect::Method method, *Jni::java::lang::Object object,...) |
| Invokes a method with the given arguments in a non-virtual way; meaning that even if the object provided is a child class, the method given in the first argument is executed. More...
|
|
Jni::java::lang::Class | Jni::org::qore::jni::load_class (string name) |
| Loads a Java class with given name. More...
|
|
Jni::org::qore::jni::JavaArray | Jni::org::qore::jni::new_array (Jni::java::lang::Class cls, int size) |
| Allocates a new Java array. More...
|
|
| Jni::org::qore::jni::set_save_object_callback (*code save_object_callback) |
| Sets the "save object" callback for Qore objects created from Java code. More...
|
|
Jni::org::qore::jni::set_save_object_callback |
( |
*code |
save_object_callback | ) |
|
Sets the "save object" callback for Qore objects created from Java code.
- Restrictions:
- Qore::PO_NO_PROCESS_CONTROL
- Example:
hash<string, object> object_cache;
code callback = sub (object obj) {
object_cache{obj.uniqueHash()} = obj;
}
- Parameters
-
save_object_callback | the callback to save any Qore objects created in Java code, must take an argument of type object |
Due to the differences in garbage collection approaches between Qore and Java, Qore objects must be managed with a deterministic life cycle; Java objects have only weak references to Qore objects due to the lack of destructors in Java and the lack of determinism in the JVM for object lifecycle management.
The callback set here will be called any time a Qore object is created from Java code; if no callback is set, then the standard thread-local implementation is used where Qore objects are saved in a thread-local hash.
- See also
- Managing the Lifecycle of Qore objects from Java for more information