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

#include "NativeExternRecordWithDerivings.hpp"  // my header
#include "NativeColor.hpp"
#include "NativeRecordWithDerivings.hpp"

namespace djinni_generated {

NativeExternRecordWithDerivings::NativeExternRecordWithDerivings() = default;

NativeExternRecordWithDerivings::~NativeExternRecordWithDerivings() = default;

auto NativeExternRecordWithDerivings::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
    const auto& data = ::djinni::JniClass<NativeExternRecordWithDerivings>::get();
    auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
                                                           ::djinni::get(::djinni_generated::NativeRecordWithDerivings::fromCpp(jniEnv, c.member)),
                                                           ::djinni::get(::djinni_generated::NativeColor::fromCpp(jniEnv, c.e)))};
    ::djinni::jniExceptionCheck(jniEnv);
    return r;
}

auto NativeExternRecordWithDerivings::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
    ::djinni::JniLocalScope jscope(jniEnv, 3);
    assert(j != nullptr);
    const auto& data = ::djinni::JniClass<NativeExternRecordWithDerivings>::get();
    return {::djinni_generated::NativeRecordWithDerivings::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mMember)),
            ::djinni_generated::NativeColor::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mE))};
}

}  // namespace djinni_generated
