Codemesh Runtime v3 C++ API Reference
3.9.205
|
A class implementing the xmog_java_dynamic interface for accessing Java methods via JNI or Codemesh's remoting protocol. More...
#include <xmog_java_method.h>
Public Member Functions | |
xmog_java_method (xmog_java_class *clazz, jmethodID mid, bool bStatic=false, bool bIndirect=false) | |
The constructor from existing method ID. More... | |
xmog_java_method (xmog_java_class *clazz, const char *name, const char *type, bool bStatic=false, bool bIndirect=false) | |
The constructor from name and type. More... | |
xmog_java_method (const xmog_java_method &rhs) | |
The copy constructor, required for the infrastructure of STL support. More... | |
void * | operator new (size_t) |
Overloaded operator new that allows us to detect whether the instance is heap-allocated or not. | |
void | operator delete (void *) |
Overloaded operator delete that is safe to use for non heap-allocated instances. | |
xmog_java_method * | next () |
Returns the next method declared by the same type. | |
xmog_java_class * | clazz () |
Returns the method's declaring type. | |
const char * | name () |
Returns the known method name. More... | |
const char * | type () |
Returns the known return type signature. More... | |
bool | is_static () const |
Returns true if the method is static. | |
void | set_methodID (jmethodID mid) |
Sets the method's ID. More... | |
int | initializeMethodID (xmog_localenv *env) |
Calculates the methodID based on the information maintained by this instance. More... | |
jmethodID | get_methodID () |
Returns the field's ID. | |
jobjectArray | get_argument_array (xmog_java_values *values, xmog_localenv *env=NULL) |
Returns an object array containing Value objects corresponding to the passed in values. More... | |
virtual bool | get_bool (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a boolean method. More... | |
virtual jboolean | get_jboolean (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a boolean method. More... | |
virtual jbyte | get_byte (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a byte method. More... | |
virtual jchar | get_char (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a char method. More... | |
virtual jdouble | get_double (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a double method. More... | |
virtual jfloat | get_float (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a float method. More... | |
virtual jint | get_int (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a int method. More... | |
virtual jlong | get_long (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a long method. More... | |
virtual jshort | get_short (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value returned by a short method. More... | |
virtual jobject | get_jobject (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) |
Returns the value returned by a reference type method. More... | |
virtual void | get_void (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Dynamically resolves a reference that evaluates to a void value. More... | |
virtual void | set_bool (xmog_base *obj, bool b, xmog_localenv *env=NULL) |
Sets a bool value of a dynamic instance. More... | |
virtual void | set_jboolean (xmog_base *obj, jboolean b, xmog_localenv *env=NULL) |
Sets a jboolean value of a dynamic instance. More... | |
virtual void | set_byte (xmog_base *obj, jbyte b, xmog_localenv *env=NULL) |
Sets a jbyte value of a dynamic instance. More... | |
virtual void | set_char (xmog_base *obj, jchar ch, xmog_localenv *env=NULL) |
Sets a jchar value of a dynamic instance. More... | |
virtual void | set_double (xmog_base *obj, jdouble d, xmog_localenv *env=NULL) |
Sets a double value of a dynamic instance. More... | |
virtual void | set_float (xmog_base *obj, jfloat f, xmog_localenv *env=NULL) |
Sets a float value of a dynamic instance. More... | |
virtual void | set_int (xmog_base *obj, jint i, xmog_localenv *env=NULL) |
Sets an int value of a dynamic instance. More... | |
virtual void | set_long (xmog_base *obj, jlong l, xmog_localenv *env=NULL) |
Sets a long value of a dynamic instance. More... | |
virtual void | set_short (xmog_base *obj, jshort sh, xmog_localenv *env=NULL) |
Sets a short value of a dynamic instance. More... | |
virtual void | set_jobject (xmog_base *obj, jobject o, xmog_localenv *env=NULL) |
Sets an object reference into a dynamic instance. More... | |
void | call_remote (xmog_remote_java_value &result, int mid, xmog_base *base, xmog_java_values *args, xmog_localenv *env) |
Calls a remote method in the shared JVM. More... | |
Public Member Functions inherited from xmog_java_dynamic | |
int | handleException (int error_code, xmog_localenv *env=NULL) |
Handles an exception. | |
Friends | |
class | xmog_java_class |
A class implementing the xmog_java_dynamic interface for accessing Java methods via JNI or Codemesh's remoting protocol.
This type is a specialization of the xmog_java_dynamic interface that knows how to call Java methods. This type is a support type that is used by the actual proxy methods. Each declared method is represented by exactly one instance of an xmog_java_method. That instance is then used by a concrete method to call the underlying Java method. The following snippet illustrates the infrastructure:
and the following snippet illustrates how the generated code uses the infrastructure:
xmog_java_method::xmog_java_method | ( | xmog_java_class * | clazz, |
jmethodID | mid, | ||
bool | bStatic = false , |
||
bool | bIndirect = false |
||
) |
The constructor from existing method ID.
clazz | pointer to the class instance that declares the method. |
mid | the method identifier. |
bStatic | true if the method is a static method, false if not. Default value is false . |
bIndirect | true if the method requires another Java method on the callstack. Default value is false . |
xmog_java_method::xmog_java_method | ( | xmog_java_class * | clazz, |
const char * | name, | ||
const char * | type, | ||
bool | bStatic = false , |
||
bool | bIndirect = false |
||
) |
The constructor from name and type.
clazz | pointer to the class instance that declares the method. |
name | the method name. |
type | the method type. |
bStatic | true if the method is a static method, false if not. Default value is false . |
bIndirect | true if the method requires another Java method on the callstack. Default value is false . |
xmog_java_method::xmog_java_method | ( | const xmog_java_method & | rhs | ) |
The copy constructor, required for the infrastructure of STL support.
rhs | the method to copy from. |
void xmog_java_method::call_remote | ( | xmog_remote_java_value & | result, |
int | mid, | ||
xmog_base * | base, | ||
xmog_java_values * | args, | ||
xmog_localenv * | env | ||
) |
Calls a remote method in the shared JVM.
result | the result holder. |
mid | the method identifier. |
base | the target. |
args | the arguments. |
jobjectArray xmog_java_method::get_argument_array | ( | xmog_java_values * | values, |
xmog_localenv * | env = NULL |
||
) |
Returns an object array containing Value objects corresponding to the passed in values.
values | the argument holder. |
env | the local call environment. Defaults to NULL . |
|
virtual |
Returns the value returned by a boolean method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a byte
method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a char
method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a double
method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a float
method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a int
method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a boolean method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a reference type method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a long
method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value returned by a short
method.
obj | pointer to the owning instance or NULL if the method is static. |
args | always NULL . |
env | the local environment used in this call. This value may be NULL . |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
|
virtual |
Dynamically resolves a reference that evaluates to a void value.
This function is mostly useful for method invocations.
obj | the object which we're going to use to derive the value the dynamic value. This is typically a proxy instance representing a Java object. |
args | the arguments used to derive the dynamic value. This will tpyically be the array of parameters passed to a method or NULL. The default value is NULL. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
flags | the processing flags for the operation. The default value is 0. |
Implements xmog_java_dynamic.
int xmog_java_method::initializeMethodID | ( | xmog_localenv * | env | ) |
Calculates the methodID based on the information maintained by this instance.
env | the local environment used for this operation. |
const char* xmog_java_method::name | ( | ) |
Returns the known method name.
This method may return NULL
if it was constructed with a known methodID as input.
|
virtual |
Sets a bool value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
b | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
|
virtual |
Sets a jbyte
value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
b | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
|
virtual |
Sets a jchar
value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
ch | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
|
virtual |
Sets a double
value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
d | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
|
virtual |
Sets a float
value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
f | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
|
virtual |
Sets an int
value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
i | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
|
virtual |
Sets a jboolean
value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
b | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
|
virtual |
Sets an object reference into a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
o | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
|
virtual |
Sets a long
value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
l | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
void xmog_java_method::set_methodID | ( | jmethodID | mid | ) |
Sets the method's ID.
This method is used when we perform bulk initialization of elements declared by a type in the remoting protocol.
|
virtual |
Sets a short
value of a dynamic instance.
obj | the object which we're going to use as the target for the dynamic value. This is typically a proxy instance representing a Java object. |
sh | the new value. |
env | the local environment used for the request. If NULL is passed, a local environment is acquired in the execution of the request. The default value is NULL. |
Implements xmog_java_dynamic.
const char* xmog_java_method::type | ( | ) |
Returns the known return type signature.
This method may return NULL
if it was constructed with a known methodID as input.