Codemesh Runtime v3 C++ API Reference
3.9.205
|
A class implementing the xmog_java_dynamic interface for accessing Java fields via JNI or Codemesh's remoting protocol. More...
#include <xmog_java_field.h>
Public Member Functions | |
xmog_java_field (xmog_java_class *clazz, jfieldID fid, bool bStatic=false) | |
The constructor that takes an externally calculated jfieldID as input. More... | |
xmog_java_field (xmog_java_class *clazz, const char *name, const char *type, bool bStatic=false) | |
The constructor that takes all information required to calculate a jfieldID as input. More... | |
~xmog_java_field () | |
Removes the field instance from the declaring class' list of fields. | |
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_field * | next () |
Returns the next field declared by the same type. | |
xmog_java_class * | clazz () |
Returns the declaring class. | |
const char * | name () |
Returns the field's name. | |
const char * | type () |
Returns the field's type in internal form. | |
bool | is_static () const |
Returns true if the field is static, false otherwise. | |
void | set_fieldID (jfieldID fid) |
Sets the field's ID. More... | |
jfieldID | get_fieldID () |
Returns the field's ID. | |
int | initializeFieldID (xmog_localenv *env) |
Calculates the fieldID based on the information maintained by this instance. More... | |
virtual bool | get_bool (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of a boolean field. More... | |
virtual jboolean | get_jboolean (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of a boolean field. More... | |
virtual jbyte | get_byte (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of a byte field. More... | |
virtual jchar | get_char (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of a char field. More... | |
virtual jdouble | get_double (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of a double field. More... | |
virtual jfloat | get_float (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of a float field. More... | |
virtual jint | get_int (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of an int field. More... | |
virtual jlong | get_long (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of a long field. More... | |
virtual jshort | get_short (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Returns the value of a short field. 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 of an object field. More... | |
virtual void | get_void (xmog_base *obj, xmog_java_values *args=NULL, xmog_localenv *env=NULL, xmog_flags flags=0) |
Not implemented for this type. More... | |
virtual void | set_bool (xmog_base *obj, bool b, xmog_localenv *env=NULL) |
Sets the value of a boolean field. More... | |
virtual void | set_jboolean (xmog_base *obj, jboolean b, xmog_localenv *env=NULL) |
Sets the value of a boolean field. More... | |
virtual void | set_byte (xmog_base *obj, jbyte b, xmog_localenv *env=NULL) |
Sets the value of a byte field. More... | |
virtual void | set_char (xmog_base *obj, jchar ch, xmog_localenv *env=NULL) |
Sets the value of a char field. More... | |
virtual void | set_double (xmog_base *obj, jdouble d, xmog_localenv *env=NULL) |
Sets the value of a double field. More... | |
virtual void | set_float (xmog_base *obj, jfloat f, xmog_localenv *env=NULL) |
Sets the value of a float field. More... | |
virtual void | set_int (xmog_base *obj, jint i, xmog_localenv *env=NULL) |
Sets the value of an int field. More... | |
virtual void | set_long (xmog_base *obj, jlong l, xmog_localenv *env=NULL) |
Sets the value of a long field. More... | |
virtual void | set_short (xmog_base *obj, jshort sh, xmog_localenv *env=NULL) |
Sets the value of a short field. More... | |
virtual void | set_jobject (xmog_base *obj, jobject o, xmog_localenv *env=NULL) |
Sets the value of an object field. 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 fields via JNI or Codemesh's remoting protocol.
This type is a specialization of the xmog_java_dynamic interface that knows how to get and set field values of Java instances. This type is a support type that is used by the actual proxy fields. Each declared field is represented by exactly one instance of an xmog_java_field. That instance is then used by a concrete field to access the underlying Java instance. The following snippet illustrates the infrastructure:
and the following snippet illustrates how the generated code uses the infrastructure:
xmog_java_field::xmog_java_field | ( | xmog_java_class * | clazz, |
jfieldID | fid, | ||
bool | bStatic = false |
||
) |
The constructor that takes an externally calculated jfieldID
as input.
This constructor allows us to create an easy to use wrapper instance for an existing jfieldID
. This constructor adds the field instance to the list of fields maintained by the declaring class.
clazz | the declaring type. |
fid | the fieldID. |
bStatic | true if we have a static field, false otherwise. |
xmog_java_field::xmog_java_field | ( | xmog_java_class * | clazz, |
const char * | name, | ||
const char * | type, | ||
bool | bStatic = false |
||
) |
The constructor that takes all information required to calculate a jfieldID
as input.
This constructor adds the field instance to the list of fields maintained by the declaring class.
clazz | the declaring type. |
name | the field name. The caller owns the string. |
type | the field type in internal format. The caller owns the string. |
bStatic | true if we have a static field, false otherwise. |
|
virtual |
Returns the value of a boolean field.
obj | pointer to the owning instance or NULL if the field 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 of a byte field.
obj | pointer to the owning instance or NULL if the field 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 of a char field.
obj | pointer to the owning instance or NULL if the field 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 of a double field.
obj | pointer to the owning instance or NULL if the field 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 of a float field.
obj | pointer to the owning instance or NULL if the field 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 of an int field.
obj | pointer to the owning instance or NULL if the field 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 of a boolean field.
obj | pointer to the owning instance or NULL if the field 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 of an object field.
obj | pointer to the owning instance or NULL if the field 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 xmog_base::GLOBAL. |
Implements xmog_java_dynamic.
|
virtual |
Returns the value of a long field.
obj | pointer to the owning instance or NULL if the field 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 of a short field.
obj | pointer to the owning instance or NULL if the field 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 |
Not implemented for this type.
There are no fields of type void
.
obj | pointer to the owning instance or NULL if the field 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.
int xmog_java_field::initializeFieldID | ( | xmog_localenv * | env | ) |
Calculates the fieldID based on the information maintained by this instance.
env | the local environment used for this operation. |
|
virtual |
Sets the value of a boolean field.
obj | pointer to the owning instance or NULL if the field is static. |
b | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
|
virtual |
Sets the value of a byte field.
obj | pointer to the owning instance or NULL if the field is static. |
b | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
|
virtual |
Sets the value of a char field.
obj | pointer to the owning instance or NULL if the field is static. |
ch | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
|
virtual |
Sets the value of a double field.
obj | pointer to the owning instance or NULL if the field is static. |
d | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
void xmog_java_field::set_fieldID | ( | jfieldID | fid | ) |
Sets the field's ID.
This method is used when we perform bulk initialization of elements declared by a type in the remoting protocol.
|
virtual |
Sets the value of a float field.
obj | pointer to the owning instance or NULL if the field is static. |
f | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
|
virtual |
Sets the value of an int field.
obj | pointer to the owning instance or NULL if the field is static. |
i | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
|
virtual |
Sets the value of a boolean field.
obj | pointer to the owning instance or NULL if the field is static. |
b | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
|
virtual |
Sets the value of an object field.
obj | pointer to the owning instance or NULL if the field is static. |
o | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
|
virtual |
Sets the value of a long field.
obj | pointer to the owning instance or NULL if the field is static. |
l | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.
|
virtual |
Sets the value of a short field.
obj | pointer to the owning instance or NULL if the field is static. |
sh | the new value of the field. |
env | the local environment used in this call. This value may be NULL . |
Implements xmog_java_dynamic.