GetStatic<type>Field Routines - GetStaticDoubleField
NativeType GetStatic<type>Field
(JNIEnv *env, jclass clazz, jfieldID fieldID);
This family of accessor routines returns the value of a static field of an object. The field to access is specified by a field ID, which is obtained by calling
GetStaticFieldID()
. (GetStaticDoubleField)
The following table describes the family of get routine names and result types. You should replace type in GetStatic<type>Field with the Java type of the field, or one of the actual static field accessor routine names from the table, and replace NativeType with the corresponding native type for that routine.
Table 4-5a GetStatic<type>Field Family of Accessor Routines
LINKAGE:
Indices in the JNIEnv interface function table.
Table 4-5b GetStatic<type>Field Family of Accessor Routines
PARAMETERS:
env
: the JNI interface pointer.clazz
: a Java class object.fieldID
: a static field ID.RETURNS:
Returns the content of the static field.
Example of GetStaticDoubleField
{
jfieldID jFieldId;
jdouble iStaticDoubleVal;
jclass cls = (*env)->GetObjectClass(env, jobj);
jFieldId = (*env)->GetStaticFieldID(env,cls,"iStaticDoubleVal","D");
if(jFieldId == 0) {
printf("Field iStaticDoubleVal not Found in Hello class\n");
return;
}iStaticDoubleVal = (*env)->GetStaticDoubleField(env,cls,jFieldId);
(*env)->SetStaticDoubleField(env,cls,jFieldId,(iStaticDoubleVal +2.0));
jdouble iStaticDoubleVal;
jclass cls = (*env)->GetObjectClass(env, jobj);
jFieldId = (*env)->GetStaticFieldID(env,cls,"iStaticDoubleVal","D");
if(jFieldId == 0) {
printf("Field iStaticDoubleVal not Found in Hello class\n");
return;
}iStaticDoubleVal = (*env)->GetStaticDoubleField(env,cls,jFieldId);
(*env)->SetStaticDoubleField(env,cls,jFieldId,(iStaticDoubleVal +2.0));
}