MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / setIntField

Function setIntField

termux/termux-shared/src/main/cpp/local-socket.cpp:222–234  ·  view source on GitHub ↗

Set int fieldName field for clazz to value. */

Source from the content-addressed store, hash-verified

220
221/* Set int fieldName field for clazz to value. */
222string setIntField(JNIEnv *env, jobject obj, jclass clazz, const string fieldName, const int value) {
223 jfieldID field = env->GetFieldID(clazz, fieldName.c_str(), "I");
224 if (checkJniException(env)) return JNI_EXCEPTION;
225 if (!field) {
226 return "Failed to get int \"" + string(fieldName) + "\" field of \"" +
227 get_class_name(env, clazz) + "\" class to set value \"" + to_string(value) + "\"";
228 }
229
230 env->SetIntField(obj, field, value);
231 if (checkJniException(env)) return JNI_EXCEPTION;
232
233 return "";
234}
235
236/* Set String fieldName field for clazz to value. */
237string setStringField(JNIEnv *env, jobject obj, jclass clazz, const string fieldName, const string value) {

Calls 4

checkJniExceptionFunction · 0.85
stringClass · 0.85
get_class_nameFunction · 0.85
to_stringFunction · 0.85

Tested by

no test coverage detected