// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from inttypes.djinni

#include "NativeAssortedIntegers.hpp"  // my header
#include "HI16.hpp"
#include "HI32.hpp"
#include "HI64.hpp"
#include "HI8.hpp"
#include "HOptional.hpp"

namespace djinni_generated {

jobject NativeAssortedIntegers::toJava(JNIEnv* jniEnv, AssortedIntegers c) {
    jbyte j_eight = ::djinni::HI8::Unboxed::toJava(jniEnv, c.eight);
    jshort j_sixteen = ::djinni::HI16::Unboxed::toJava(jniEnv, c.sixteen);
    jint j_thirtytwo = ::djinni::HI32::Unboxed::toJava(jniEnv, c.thirtytwo);
    jlong j_sixtyfour = ::djinni::HI64::Unboxed::toJava(jniEnv, c.sixtyfour);
    djinni::LocalRef<jobject> j_o_eight(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HI8>::toJava(jniEnv, c.o_eight));
    djinni::LocalRef<jobject> j_o_sixteen(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HI16>::toJava(jniEnv, c.o_sixteen));
    djinni::LocalRef<jobject> j_o_thirtytwo(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HI32>::toJava(jniEnv, c.o_thirtytwo));
    djinni::LocalRef<jobject> j_o_sixtyfour(jniEnv, ::djinni::HOptional<std::experimental::optional, ::djinni::HI64>::toJava(jniEnv, c.o_sixtyfour));
    const auto & data = djinni::JniClass<::djinni_generated::NativeAssortedIntegers>::get();
    jobject r = jniEnv->NewObject(data.clazz.get(), data.jconstructor, j_eight, j_sixteen, j_thirtytwo, j_sixtyfour, j_o_eight.get(), j_o_sixteen.get(), j_o_thirtytwo.get(), j_o_sixtyfour.get());
    djinni::jniExceptionCheck(jniEnv);
    return r;
}

AssortedIntegers NativeAssortedIntegers::fromJava(JNIEnv* jniEnv, jobject j) {
    assert(j != nullptr);
    const auto & data = djinni::JniClass<::djinni_generated::NativeAssortedIntegers>::get();
    return AssortedIntegers(
        ::djinni::HI8::Unboxed::fromJava(jniEnv, jniEnv->GetByteField(j, data.field_mEight)),
        ::djinni::HI16::Unboxed::fromJava(jniEnv, jniEnv->GetShortField(j, data.field_mSixteen)),
        ::djinni::HI32::Unboxed::fromJava(jniEnv, jniEnv->GetIntField(j, data.field_mThirtytwo)),
        ::djinni::HI64::Unboxed::fromJava(jniEnv, jniEnv->GetLongField(j, data.field_mSixtyfour)),
        ::djinni::HOptional<std::experimental::optional, ::djinni::HI8>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mOEight)).get()),
        ::djinni::HOptional<std::experimental::optional, ::djinni::HI16>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mOSixteen)).get()),
        ::djinni::HOptional<std::experimental::optional, ::djinni::HI32>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mOThirtytwo)).get()),
        ::djinni::HOptional<std::experimental::optional, ::djinni::HI64>::fromJava(jniEnv, djinni::LocalRef<jobject>(jniEnv, jniEnv->GetObjectField(j, data.field_mOSixtyfour)).get()));
}

}  // namespace djinni_generated
