Example #1
0
    static bool getMethodInfo_(DCJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode)
    {
        jmethodID methodID = 0;
        JNIEnv *pEnv = 0;
        bool bRet = false;

        do 
        {
            if (! getEnv(&pEnv))
            {
                break;
            }

            jclass classID = getClassID_(className, pEnv);

            methodID = pEnv->GetMethodID(classID, methodName, paramCode);
            if (! methodID)
            {
                LOGD("Failed to find method id of %s", methodName);
                break;
            }

            methodinfo.classID = classID;
            methodinfo.env = pEnv;
            methodinfo.methodID = methodID;

            bRet = true;
        } while (0);

        return bRet;
    }
static bool getStaticMethodInfo_(loomJniMethodInfo& methodinfo, const char *className, const char *methodName, const char *paramCode)
{
    jmethodID methodID = 0;
    JNIEnv    *pEnv    = 0;
    bool      bRet     = false;

    do
    {
        if (!getEnv(&pEnv))
        {
            break;
        }

        jclass classID = getClassID_(className, pEnv);

        if (!classID)
        {
            return false;
        }

        methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode);
        if (!methodID)
        {
            lmLog(jniLogGroup, "Failed to find static method id of %s on class %s", methodName, className);
            break;
        }

        methodinfo.classID  = classID;
        methodinfo.methodID = methodID;

        bRet = true;
    } while (0);

    return bRet;
}
jclass PluginJniHelper::getClassID(const char *className, JNIEnv *env)
{
    return getClassID_(className, env);
}
jclass LoomJni::getClassID(const char *className, JNIEnv *env)
{
    return getClassID_(className, env);
}
Example #5
0
jclass JNIHelper::getStaticClass(const char *className){
	return getClassID_(className);
}