chromium/third_party/jni_zero/test/golden/testBidirectionalClass-SampleForTestsJni.java.golden

//
// This file was generated by //third_party/jni_zero/jni_zero.py
//
package org.jni_zero;

import android.graphics.Rect;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jni_zero.CheckDiscard;
import org.jni_zero.GEN_JNI;
import org.jni_zero.JniStaticTestMocker;
import org.jni_zero.NativeLibraryLoadedStatus;
import org.jni_zero.SampleForTests;
import org.jni_zero.SampleUnderSamePackage;

@CheckDiscard("crbug.com/993421")
public class SampleForTestsJni implements SampleForTests.Natives {
  private static SampleForTests.Natives testInstance;

  public static final JniStaticTestMocker<SampleForTests.Natives> TEST_HOOKS =
      new JniStaticTestMocker<SampleForTests.Natives>() {
    @Override
    public void setInstanceForTesting(SampleForTests.Natives instance) {
      if (!GEN_JNI.TESTING_ENABLED) {
        throw new RuntimeException(
            "Tried to set a JNI mock when mocks aren't enabled!");
      }
      testInstance = instance;
    }
  };

  @Override
  public void addStructB(long nativeCPPClass, SampleForTests caller, SampleForTests.InnerStructB b) {
    assert nativeCPPClass != 0;
    GEN_JNI.org_jni_1zero_SampleForTests_addStructB(nativeCPPClass, caller, b);
  }

  @Override
  public void classUnderSamePackageTest(SampleUnderSamePackage arg) {
    GEN_JNI.org_jni_1zero_SampleForTests_classUnderSamePackageTest(arg);
  }

  @Override
  public void destroy(long nativeCPPClass, SampleForTests caller, byte[] bytes) {
    assert nativeCPPClass != 0;
    GEN_JNI.org_jni_1zero_SampleForTests_destroy(
        nativeCPPClass,
        caller,
        bytes);
  }

  @Override
  public Class getClass(Class env) {
    return (Class) GEN_JNI.org_jni_1zero_SampleForTests_getClass(env);
  }

  @Override
  public double getDoubleFunction(SampleForTests ret) {
    return (double) GEN_JNI.org_jni_1zero_SampleForTests_getDoubleFunction(
        ret);
  }

  @Override
  public float getFloatFunction() {
    return (float) GEN_JNI.org_jni_1zero_SampleForTests_getFloatFunction();
  }

  @Override
  public Object getNonPODDatatype(SampleForTests jcaller) {
    return (Object) GEN_JNI.org_jni_1zero_SampleForTests_getNonPODDatatype(
        jcaller);
  }

  @Override
  public Throwable getThrowable(Throwable arg0) {
    return (Throwable) GEN_JNI.org_jni_1zero_SampleForTests_getThrowable(arg0);
  }

  @Override
  public long init(SampleForTests caller, String param, byte[] bytes, SampleForTests convertedType, SampleForTests[] nonConvertedArray) {
    return (long) GEN_JNI.org_jni_1zero_SampleForTests_init(
        caller,
        param,
        bytes,
        convertedType,
        nonConvertedArray);
  }

  @Override
  public void iterateAndDoSomethingWithStructB(long nativeCPPClass, SampleForTests caller) {
    assert nativeCPPClass != 0;
    GEN_JNI.org_jni_1zero_SampleForTests_iterateAndDoSomethingWithStructB(
        nativeCPPClass,
        caller);
  }

  @Override
  public List listTest2(Set items) {
    return (List) GEN_JNI.org_jni_1zero_SampleForTests_listTest2(items);
  }

  @Override
  public Map mapTest2(Map arg0) {
    return (Map) GEN_JNI.org_jni_1zero_SampleForTests_mapTest2(arg0);
  }

  @Override
  public int method(long nativeCPPClass, SampleForTests caller, String[] strings) {
    assert nativeCPPClass != 0;
    return (int) GEN_JNI.org_jni_1zero_SampleForTests_method(
        nativeCPPClass,
        caller,
        strings);
  }

  @Override
  public double methodOtherP0(long nativePtr, SampleForTests caller) {
    assert nativePtr != 0;
    return (double) GEN_JNI.org_jni_1zero_SampleForTests_methodOtherP0(
        nativePtr,
        caller);
  }

  @Override
  public boolean[] primitiveArrays(byte[] b, char[] c, short[] s, int[] i, long[] l, float[] f, double[] d) {
    return (boolean[]) GEN_JNI.org_jni_1zero_SampleForTests_primitiveArrays(
        b,
        c,
        s,
        i,
        l,
        f,
        d);
  }

  @Override
  public String returnAString(long nativeCPPClass, SampleForTests caller) {
    assert nativeCPPClass != 0;
    return (String) GEN_JNI.org_jni_1zero_SampleForTests_returnAString(
        nativeCPPClass,
        caller);
  }

  @Override
  public void setNonPODDatatype(SampleForTests obj, Rect rect) {
    GEN_JNI.org_jni_1zero_SampleForTests_setNonPODDatatype(obj, rect);
  }

  public static SampleForTests.Natives get() {
    if (GEN_JNI.TESTING_ENABLED) {
      if (testInstance != null) {
        return testInstance;
      }
      if (GEN_JNI.REQUIRE_MOCK) {
        throw new UnsupportedOperationException(
            "No mock found for the native implementation of SampleForTests.Natives. "
            + "The current configuration requires implementations be mocked.");
      }
    }
    NativeLibraryLoadedStatus.checkLoaded();
    return new SampleForTestsJni();
  }
}