Initial commit 🎉
fbshipit-source-id: b6fc29740c6875d2e78953b8a7123890a67930f2 Co-authored-by: Sebastian McKenzie <sebmck@fb.com> Co-authored-by: John Knox <jknox@fb.com> Co-authored-by: Emil Sjölander <emilsj@fb.com> Co-authored-by: Pritesh Nandgaonkar <prit91@fb.com>
This commit is contained in:
25
libs/fbjni/src/main/cpp/include/jni/Registration.h
Normal file
25
libs/fbjni/src/main/cpp/include/jni/Registration.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include <jni.h>
|
||||
#include <initializer_list>
|
||||
#include <fb/assert.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace jni {
|
||||
|
||||
static inline void registerNatives(JNIEnv* env, jclass cls, std::initializer_list<JNINativeMethod> methods) {
|
||||
auto result = env->RegisterNatives(cls, methods.begin(), methods.size());
|
||||
FBASSERT(result == 0);
|
||||
}
|
||||
|
||||
static inline void registerNatives(JNIEnv* env, const char* cls, std::initializer_list<JNINativeMethod> list) {
|
||||
registerNatives(env, env->FindClass(cls), list);
|
||||
}
|
||||
|
||||
} }
|
||||
Reference in New Issue
Block a user