![]() |
Qore jni Module 2.4.0
|
Functions | |
| Jni::org::qore::jni::Class | Jni::org::qore::jni::define_class (string name, binary bytecode) |
| Creates a class object from bytecode data. | |
| binary | Jni::org::qore::jni::get_byte_code (string class_name) |
| Returns dynamically generated Java byte code for the given Qore class. | |
| Jni::java::lang::Object | Jni::org::qore::jni::get_class_loader () |
| Returns the class loader associated with the current program. | |
| string | Jni::org::qore::jni::get_version () |
| Returns the version of the JNI API. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| Jni::java::lang::Class | Jni::org::qore::jni::load_class (string name) |
| Loads a Java class with given name. | |
| Jni::org::qore::jni::JavaArray | Jni::org::qore::jni::new_array (Jni::java::lang::Class cls, int size) |
| Allocates a new Java array. | |
| Jni::org::qore::jni::set_save_object_callback (*code save_object_callback) | |
| Sets the "save object" callback for Qore objects created from Java code. | |
| Jni::org::qore::jni::Class Jni::org::qore::jni::define_class | ( | string | name, |
| binary | bytecode ) |
Creates a class object from bytecode data.
| name | the name of the class (ex: "org/qore/my_package/ClassName") |
| bytecode | the byte code of the class |
| binary Jni::org::qore::jni::get_byte_code | ( | string | class_name | ) |
Returns dynamically generated Java byte code for the given Qore class.
| class_name | the class name (can include a namespace path) to the Qore class |
| CLASS-NOT-FOUND | the Qore class could not be found |
| Jni::java::lang::Object Jni::org::qore::jni::get_class_loader | ( | ) |
Returns the class loader associated with the current program.
| string Jni::org::qore::jni::get_version | ( | ) |
Returns the version of the JNI API.
| 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.
| classLoader | the class loader that loaded the interface |
| invocationHandler | the invocation handler |
| cls | the interface to implement |
| 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.
| invocationHandler | the invocation handler |
| cls | the interface to implement |
| 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.
| method | the method to invoke |
| object | the object to use to invoke the method; for static methods, this argument can be nothing |
java.lang.reflect.InvocationTargetException objects)| 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.
| method | the method to invoke |
| object | the object to use to invoke the method; for static methods, this argument can be nothing |
java.lang.reflect.InvocationTargetException objects)| Jni::java::lang::Class Jni::org::qore::jni::load_class | ( | string | name | ) |
Loads a Java class with given name.
| name | the name of the class to load in internal ("java/lang/String") format |
| JNI-ERROR | if the class cannot be loaded |
| Jni::org::qore::jni::JavaArray Jni::org::qore::jni::new_array | ( | Jni::java::lang::Class | cls, |
| int | size ) |
Allocates a new Java array.
| cls | the Class of the component type of the Array |
| size | the size of the array to allocate |
| Jni::org::qore::jni::set_save_object_callback | ( | *code | save_object_callback | ) |
Sets the "save object" callback for Qore objects created from Java code.
| 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.