当前位置: 首页>>代码示例>>C++>>正文


C++ JEnv::GetObjectClass方法代码示例

本文整理汇总了C++中JEnv::GetObjectClass方法的典型用法代码示例。如果您正苦于以下问题:C++ JEnv::GetObjectClass方法的具体用法?C++ JEnv::GetObjectClass怎么用?C++ JEnv::GetObjectClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JEnv的用法示例。


在下文中一共展示了JEnv::GetObjectClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: clazz

Local<Object> ObjectManager::CreateJSWrapper(jint javaObjectID, const string& typeName, jobject instance)
{
	JEnv env;

	JniLocalRef clazz(env.GetObjectClass(instance));

	return CreateJSWrapperHelper(javaObjectID, typeName, clazz);
}
开发者ID:atifzaidi,项目名称:android-runtime,代码行数:8,代码来源:ObjectManager.cpp

示例2: GetClassName

string ObjectManager::GetClassName(jobject javaObject)
{
	JEnv env;

	JniLocalRef objectClass(env.GetObjectClass(javaObject));

	return GetClassName((jclass) objectClass);
}
开发者ID:atifzaidi,项目名称:android-runtime,代码行数:8,代码来源:ObjectManager.cpp

示例3: AppInitCallback

void NativePlatform::AppInitCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
	try {
	auto isolate = Isolate::GetCurrent();

	if (args.Length() != 1)
	{
		throw NativeScriptException(string("Application should be initialized with single parameter"));
	}
	if (!args[0]->IsObject())
	{
		throw NativeScriptException(string("Application should be initialized with single object parameter containing overridden methods"));
	}

	// TODO: find another way to get "com/tns/NativeScriptApplication" metadata (move it to more appropriate place)
	auto node = MetadataNode::GetOrCreate("com/tns/NativeScriptApplication");
	auto appInstance = node->CreateJSWrapper(isolate);
	DEBUG_WRITE("Application object created id: %d", appInstance->GetIdentityHash());

	auto implementationObject = args[0]->ToObject();
	implementationObject->SetHiddenValue(V8StringConstants::GetClassImplementationObject(), External::New(isolate, node));
	DEBUG_WRITE("Application object implementation object is with id: %d", implementationObject->GetIdentityHash());
	implementationObject->SetPrototype(appInstance->GetPrototype());
	bool appSuccess = appInstance->SetPrototype(implementationObject);
	if (!appSuccess)
	{
		throw NativeScriptException(string("Application could not be initialized correctly"));
	}

	jweak applicationObject = g_objectManager->GetJavaObjectByID(AppJavaObjectID);

	JEnv env;
	jclass appClass = env.FindClass("com/tns/NativeScriptApplication");
	g_objectManager->Link(appInstance, AppJavaObjectID, appClass);

	JniLocalRef applicationClass(env.GetObjectClass(applicationObject));
	jmethodID setNativeScriptOverridesMethodId = env.GetMethodID((jclass)applicationClass, "setNativeScriptOverrides", "([Ljava/lang/String;)V");
	jobjectArray methodOverrides = NativeScriptRuntime::GetMethodOverrides(env, implementationObject);
	env.CallVoidMethod(applicationObject, setNativeScriptOverridesMethodId, methodOverrides);
	} catch (NativeScriptException& e) {
		e.ReThrowToV8();
	}
	catch (exception e) {
		DEBUG_WRITE("Error: c++ exception: %s", e.what());
	}
	catch (...) {
		DEBUG_WRITE("Error: c++ exception!");
	}
}
开发者ID:slavchev,项目名称:android-runtime,代码行数:49,代码来源:NativePlatform.cpp


注:本文中的JEnv::GetObjectClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。