chromium/third_party/jni_zero/test/golden/testBirectionalNonProxy-SampleBidirectionalNonProxy_jni.h.golden

// This file was generated by
//     //third_party/jni_zero/jni_zero.py
// For
//     org.jni_zero.SampleBidirectionalNonProxy

#ifndef org_jni_1zero_SampleBidirectionalNonProxy_JNI
#define org_jni_1zero_SampleBidirectionalNonProxy_JNI

#include <jni.h>

#include "third_party/jni_zero/jni_export.h"
#include "third_party/jni_zero/jni_zero_helper.h"
// Class Accessors.
#ifndef org_jni_1zero_SampleBidirectionalNonProxy_clazz_defined
#define org_jni_1zero_SampleBidirectionalNonProxy_clazz_defined
inline jclass org_jni_1zero_SampleBidirectionalNonProxy_clazz(JNIEnv* env) {
  static const char kClassName[] = "org/jni_zero/SampleBidirectionalNonProxy";
  static std::atomic<jclass> cached_class;
  return jni_zero::internal::LazyGetClass(env, kClassName, &cached_class);
}
#endif

// Java to native functions
// Forward declaration. To be implemented by the including .cc file.
static jint JNI_SampleBidirectionalNonProxy_Init(
    JNIEnv* env,
    const jni_zero::JavaParamRef<jobject>& jcaller);

JNI_POSSIBLE_BOUNDARY_EXPORT jint Java_org_jni_1zero_SampleBidirectionalNonProxy_nativeInit(
    JNIEnv* env,
    jobject jcaller) {
  auto _ret = JNI_SampleBidirectionalNonProxy_Init(
      env,
      jni_zero::JavaParamRef<jobject>(env, jcaller));
  return _ret;
}

// Forward declaration. To be implemented by the including .cc file.
static jint JNI_SampleBidirectionalNonProxy_Init(
    JNIEnv* env,
    const jni_zero::JavaParamRef<jobject>& jcaller);

JNI_POSSIBLE_BOUNDARY_EXPORT jint Java_org_jni_1zero_SampleBidirectionalNonProxy_nativeInit(
    JNIEnv* env,
    jobject jcaller) {
  auto _ret = JNI_SampleBidirectionalNonProxy_Init(
      env,
      jni_zero::JavaParamRef<jobject>(env, jcaller));
  return _ret;
}

JNI_POSSIBLE_BOUNDARY_EXPORT jint Java_org_jni_1zero_SampleBidirectionalNonProxy_nativeMethod(
    JNIEnv* env,
    jobject jcaller,
    jlong nativeTest,
    jint arg1) {
  auto _ret = reinterpret_cast<Test*>(nativeTest)->Method(
      env,
      jni_zero::JavaParamRef<jobject>(env, jcaller),
      arg1);
  return _ret;
}

JNI_POSSIBLE_BOUNDARY_EXPORT jint Java_org_jni_1zero_SampleBidirectionalNonProxy_nativeStaticMethod(
    JNIEnv* env,
    jclass jcaller,
    jlong nativeTest,
    jint arg1) {
  auto _ret = reinterpret_cast<Test*>(nativeTest)->StaticMethod(env, arg1);
  return _ret;
}

// Native to Java functions
static void Java_SampleBidirectionalNonProxy_addStructB(
    JNIEnv* env,
    const jni_zero::JavaRef<jobject>& obj,
    const jni_zero::JavaRef<jobject>& caller,
    const jni_zero::JavaRef<jobject>& b) {
  static std::atomic<jmethodID> cached_method_id(nullptr);
  jclass clazz = org_jni_1zero_SampleBidirectionalNonProxy_clazz(env);
  CHECK_CLAZZ(env, obj.obj(), clazz);
  jni_zero::internal::JniJavaCallContext<true> call_context;
  call_context.Init<jni_zero::MethodID::TYPE_INSTANCE>(
      env,
      clazz,
      "addStructB",
      "(Lorg/jni_zero/SampleForTests;Lorg/jni_zero/SampleForTests$InnerStructB;)V",
      &cached_method_id);
  env->CallVoidMethod(
      obj.obj(),
      call_context.method_id(),
      caller.obj(),
      b.obj());
}

static void Java_SampleBidirectionalNonProxy_setBool(
    JNIEnv* env,
    const jni_zero::JavaRef<jobject>& obj,
    const jni_zero::JavaRef<jobject>& b,
    const jni_zero::JavaRef<jobject>& i) {
  static std::atomic<jmethodID> cached_method_id(nullptr);
  jclass clazz = org_jni_1zero_SampleBidirectionalNonProxy_clazz(env);
  CHECK_CLAZZ(env, obj.obj(), clazz);
  jni_zero::internal::JniJavaCallContext<true> call_context;
  call_context.Init<jni_zero::MethodID::TYPE_INSTANCE>(
      env,
      clazz,
      "setBool",
      "(Lorg/jni_zero/Boolean;Ljava/lang/Integer;)V",
      &cached_method_id);
  env->CallVoidMethod(obj.obj(), call_context.method_id(), b.obj(), i.obj());
}

static void Java_SampleBidirectionalNonProxy_setStringBuilder(
    JNIEnv* env,
    const jni_zero::JavaRef<jobject>& obj,
    const jni_zero::JavaRef<jobject>& sb) {
  static std::atomic<jmethodID> cached_method_id(nullptr);
  jclass clazz = org_jni_1zero_SampleBidirectionalNonProxy_clazz(env);
  CHECK_CLAZZ(env, obj.obj(), clazz);
  jni_zero::internal::JniJavaCallContext<true> call_context;
  call_context.Init<jni_zero::MethodID::TYPE_INSTANCE>(
      env,
      clazz,
      "setStringBuilder",
      "(Ljava/lang/StringBuilder;)V",
      &cached_method_id);
  env->CallVoidMethod(obj.obj(), call_context.method_id(), sb.obj());
}

static jdouble Java_SampleBidirectionalNonProxy_testMethodWithNoParam(
    JNIEnv* env) {
  static std::atomic<jmethodID> cached_method_id(nullptr);
  jclass clazz = org_jni_1zero_SampleBidirectionalNonProxy_clazz(env);
  CHECK_CLAZZ(env, clazz, clazz, 0);
  jni_zero::internal::JniJavaCallContext<true> call_context;
  call_context.Init<jni_zero::MethodID::TYPE_STATIC>(
      env,
      clazz,
      "testMethodWithNoParam",
      "()D",
      &cached_method_id);
  auto _ret = env->CallStaticDoubleMethod(clazz, call_context.method_id());
  return _ret;
}

static void Java_SampleBidirectionalNonProxy_testMethodWithParam(
    JNIEnv* env,
    const jni_zero::JavaRef<jobject>& obj,
    JniIntWrapper iParam) {
  static std::atomic<jmethodID> cached_method_id(nullptr);
  jclass clazz = org_jni_1zero_SampleBidirectionalNonProxy_clazz(env);
  CHECK_CLAZZ(env, obj.obj(), clazz);
  jni_zero::internal::JniJavaCallContext<true> call_context;
  call_context.Init<jni_zero::MethodID::TYPE_INSTANCE>(
      env,
      clazz,
      "testMethodWithParam",
      "(I)V",
      &cached_method_id);
  env->CallVoidMethod(obj.obj(), call_context.method_id(), as_jint(iParam));
}

static jni_zero::ScopedJavaLocalRef<jstring> Java_SampleBidirectionalNonProxy_testMethodWithParamAndReturn(
    JNIEnv* env,
    const jni_zero::JavaRef<jobject>& obj,
    JniIntWrapper iParam) {
  static std::atomic<jmethodID> cached_method_id(nullptr);
  jclass clazz = org_jni_1zero_SampleBidirectionalNonProxy_clazz(env);
  CHECK_CLAZZ(env, obj.obj(), clazz, nullptr);
  jni_zero::internal::JniJavaCallContext<true> call_context;
  call_context.Init<jni_zero::MethodID::TYPE_INSTANCE>(
      env,
      clazz,
      "testMethodWithParamAndReturn",
      "(I)Ljava/lang/String;",
      &cached_method_id);
  auto _ret = env->CallObjectMethod(
      obj.obj(),
      call_context.method_id(),
      as_jint(iParam));
  jstring _ret2 = static_cast<jstring>(_ret);
  return jni_zero::ScopedJavaLocalRef<jstring>(env, _ret2);
}

static jni_zero::ScopedJavaLocalRef<jstring> Java_SampleBidirectionalNonProxy_testStaticMethodWithNoParam(
    JNIEnv* env) {
  static std::atomic<jmethodID> cached_method_id(nullptr);
  jclass clazz = org_jni_1zero_SampleBidirectionalNonProxy_clazz(env);
  CHECK_CLAZZ(env, clazz, clazz, nullptr);
  jni_zero::internal::JniJavaCallContext<true> call_context;
  call_context.Init<jni_zero::MethodID::TYPE_STATIC>(
      env,
      clazz,
      "testStaticMethodWithNoParam",
      "()Ljava/lang/String;",
      &cached_method_id);
  auto _ret = env->CallStaticObjectMethod(clazz, call_context.method_id());
  jstring _ret2 = static_cast<jstring>(_ret);
  return jni_zero::ScopedJavaLocalRef<jstring>(env, _ret2);
}

static jint Java_SampleBidirectionalNonProxy_testStaticMethodWithParam(
    JNIEnv* env,
    JniIntWrapper iParam) {
  static std::atomic<jmethodID> cached_method_id(nullptr);
  jclass clazz = org_jni_1zero_SampleBidirectionalNonProxy_clazz(env);
  CHECK_CLAZZ(env, clazz, clazz, 0);
  jni_zero::internal::JniJavaCallContext<true> call_context;
  call_context.Init<jni_zero::MethodID::TYPE_STATIC>(
      env,
      clazz,
      "testStaticMethodWithParam",
      "(I)I",
      &cached_method_id);
  auto _ret = env->CallStaticIntMethod(
      clazz,
      call_context.method_id(),
      as_jint(iParam));
  return _ret;
}


#endif  // org_jni_1zero_SampleBidirectionalNonProxy_JNI