Qore jni Module  1.2.0
org.qore.jni.QoreObject Class Reference

wrapper class for a Qore object; this class holds a weak reference to the Qore object More...

Inheritance diagram for org.qore.jni.QoreObject:
org.qore.jni.QoreObjectBase

Public Member Methods

 QoreObject (long obj)
 creates the wrapper object with a pointer to an object; this Java object holds a weak reference to the Qore object passed here
 
String className ()
 returns the class name for the object
 
boolean instanceOf (String class_name)
 returns true if the object is an instance of the given class
 
Object callMethod (String name, Object... args) throws Throwable
 calls the given method with the given arguments and returns the result More...
 
Object callMethodArgs (String name, Object[] args) throws Throwable
 calls the given method with the given arguments and returns the result More...
 
Object callMethodSave (String name, Object... args) throws Throwable
 Calls the given method with the given arguments and returns the result; if an object is returned, then a strong reference to the object is stored in thread-local data. More...
 
Object callMethodArgsSave (String name, Object[] args) throws Throwable
 Calls the given method with the given arguments and returns the result; if an object is returned, then a strong reference to the object is stored in thread-local data. More...
 
Object getMemberValue (String name) throws Throwable
 returns the value of the given member
 
- Public Member Methods inherited from org.qore.jni.QoreObjectBase
 QoreObjectBase (long obj)
 creates the wrapper object with a pointer to an object; this Java object holds a weak reference to the Qore object passed here
 
long get ()
 returns the pointer to the object
 
void release ()
 releases the Qore object without destroying it More...
 
void destroy ()
 runs the destructor
 

Additional Inherited Members

- Private Member Methods inherited from org.qore.jni.QoreObjectBase
void finalize () throws Throwable
 releases the weak reference
 
- Private Attributes inherited from org.qore.jni.QoreObjectBase
long obj
 a pointer to the Qore object
 

Detailed Description

wrapper class for a Qore object; this class holds a weak reference to the Qore object

Due to the different in garbage collecting approaches (Qore's garbage collector being deterministic and Java's not), strong references to Qore objects must be managed outside of Java.

Note
API usage errors such as with releasing / deleting the object and then calling methods on the object will cause a crash

Member Function Documentation

◆ callMethod()

Object org.qore.jni.QoreObject.callMethod ( String  name,
Object...  args 
) throws Throwable
inline

calls the given method with the given arguments and returns the result

Parameters
namethe name of the method to call
argsargument to the function call
Returns
the result of the call
Exceptions
Throwableany Qore-language exception is rethrown here
See also
callMethodSave()

◆ callMethodArgs()

Object org.qore.jni.QoreObject.callMethodArgs ( String  name,
Object[]  args 
) throws Throwable
inline

calls the given method with the given arguments and returns the result

Parameters
namethe name of the method to call
argsargument to the function call
Returns
the result of the call
Exceptions
Throwableany Qore-language exception is rethrown here
See also
callMethodArgsSave()

◆ callMethodArgsSave()

Object org.qore.jni.QoreObject.callMethodArgsSave ( String  name,
Object[]  args 
) throws Throwable
inline

Calls the given method with the given arguments and returns the result; if an object is returned, then a strong reference to the object is stored in thread-local data.

This method can be used to save objects in thread-local data that would otherwise go out of scope; see Managing the Lifecycle of Qore objects from Java for more information

Parameters
namethe name of the method to call
argsargument to the function call
Returns
the result of the call
Exceptions
Throwableany Qore-language exception is rethrown here
See also
jni_qore_object_lifecycle_management

◆ callMethodSave()

Object org.qore.jni.QoreObject.callMethodSave ( String  name,
Object...  args 
) throws Throwable
inline

Calls the given method with the given arguments and returns the result; if an object is returned, then a strong reference to the object is stored in thread-local data.

This method can be used to save objects in thread-local data that would otherwise go out of scope; see Managing the Lifecycle of Qore objects from Java for more information

Parameters
namethe name of the method to call
argsargument to the function call
Returns
the result of the call
Exceptions
Throwableany Qore-language exception is rethrown here
See also
jni_qore_object_lifecycle_management

The documentation for this class was generated from the following file: