В коде Java у меня есть класс с именем IdentificationResult
, который имеет 3 члена:
enrollmentID
enrollmentSettings
identParams
. Вот класс:
package com.vito.android.framework.service;
class IdentificationResult
{
class IdentParams {
byte[] otp;
String seedId;
}
String enrollmentID;
String enrollmentSettings;
List<IdentParams> identParams;
}
В основном классе у меня есть функция IdentificationResult GetAuthenticationStatus ()
, вот главный класс:
public class TokenManager
{
/* Some code goes here ... */
public IdentificationResult GetAuthenticationStatus( )
{
/* Function do some actions here ... */
return new IdentificationResult;
}
}
Я вызываю метод Java из моего C ++ код таким образом
void GetAuthenticationStatus( )
{
// Attach current thread.
JNIEnv *env = NULL;
m_javaVM->AttachCurrentThread( env, NULL );
if( env == NULL ) {
return -1;
}
jclass clazz = NULL;
clazz = env->GetObjectClass( m_classObject );
if( clazz == NULL ) {
return -1;
}
// Get class method.
jmethodID clazzMethod = NULL;
env->GetMethodID( clazz, "GetAuthenticationStatus", "(V;)Lcom/vito/android/framework/service/IdentificationResult;" );
if( clazzMethod == NULL ) {
return VCS_RESULT_ERROR;
}
// Call Java 'GetAuthenticationStatus' function.
jobject methodReturnObj = env->CallObjectMethod( m_classObject, clazzMethod );
// Get IdentificationResult Class from Object.
jclass identifyResultClass = env->GetObjectClass( methodReturnObj );
if( identifyResultClass == NULL )
{
return -1;
}
// Get identParams.
jfieldID fieldID = env->GetFieldID( identifyResultClass , "identParams", "***1. Question***");
if( fieldID == NULL ) {
return -1;
}
else
{
*** 2. Question ***
}
}
Что я должен здесь написать, чтобы получить List
идентификатор поля?
Как я могу получить или установить значение поля?