Exemplo n.º 1
0
jobject DCJniHelper::cMapToJMap(std::map<string, string>* map)
{
	DCJniMethodInfo methodInfo;
	getMethodInfo_(methodInfo, "java/util/HashMap", "<init>", "()V");
	jobject obj = methodInfo.env->NewObject(methodInfo.classID, methodInfo.methodID);

	getMethodInfo_(methodInfo, "java/util/HashMap", "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
	std::map<string, string>::iterator it;
	for(it = map->begin(); it != map->end(); ++it)
	{
		jstring key = methodInfo.env->NewStringUTF(it->first.c_str());
		jstring value = methodInfo.env->NewStringUTF(it->second.c_str());
		methodInfo.env->CallObjectMethod(obj, methodInfo.methodID, key, value);
		methodInfo.env->DeleteLocalRef(key);
		methodInfo.env->DeleteLocalRef(value);
	}
	return obj;
}
bool PluginJniHelper::getMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode)
{
    return getMethodInfo_(methodinfo, className, methodName, paramCode);
}
Exemplo n.º 3
0
bool LoomJni::getMethodInfo(loomJniMethodInfo& methodinfo, const char *className, const char *methodName, const char *paramCode)
{
    return getMethodInfo_(methodinfo, className, methodName, paramCode);
}