text: // AUTOGENERATED FILE - DO NOT MODIFY!
  // This file generated by Djinni from preferences.djinni
  
  #include "PreferencesBackend.hpp"  // my header
  #include "Marshal.hpp"
  #include "PreferencesChange.hpp"
  #include "RandomNumberGenerator.hpp"
  
  namespace djinni_generated {
  
  PreferencesBackend::PreferencesBackend() : ::djinni::JniInterface<::ledger::core::api::PreferencesBackend, PreferencesBackend>("co/ledger/core/PreferencesBackend$CppProxy") {}
  
  PreferencesBackend::~PreferencesBackend() = default;
  
  
  CJNIEXPORT void JNICALL Java_co_ledger_core_PreferencesBackend_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
  {
      try {
          DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
          delete reinterpret_cast<::djinni::CppProxyHandle<::ledger::core::api::PreferencesBackend>*>(nativeRef);
      } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
  }
  
  CJNIEXPORT jstring JNICALL Java_co_ledger_core_PreferencesBackend_00024CppProxy_native_1get(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jbyteArray j_key)
  {
      try {
          DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
          const auto& ref = ::djinni::objectFromHandleAddress<::ledger::core::api::PreferencesBackend>(nativeRef);
          auto r = ref->get(::djinni::Binary::toCpp(jniEnv, j_key));
          return ::djinni::release(::djinni::Optional<std::experimental::optional, ::djinni::String>::fromCpp(jniEnv, r));
      } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
  }
  
  CJNIEXPORT jboolean JNICALL Java_co_ledger_core_PreferencesBackend_00024CppProxy_native_1commit(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_changes)
  {
      try {
          DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
          const auto& ref = ::djinni::objectFromHandleAddress<::ledger::core::api::PreferencesBackend>(nativeRef);
          auto r = ref->commit(::djinni::List<::djinni_generated::PreferencesChange>::toCpp(jniEnv, j_changes));
          return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r));
      } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
  }
  
  CJNIEXPORT void JNICALL Java_co_ledger_core_PreferencesBackend_00024CppProxy_native_1setEncryption(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_rng, jstring j_password)
  {
      try {
          DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
          const auto& ref = ::djinni::objectFromHandleAddress<::ledger::core::api::PreferencesBackend>(nativeRef);
          ref->setEncryption(::djinni_generated::RandomNumberGenerator::toCpp(jniEnv, j_rng),
                             ::djinni::String::toCpp(jniEnv, j_password));
      } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
  }
  
  CJNIEXPORT void JNICALL Java_co_ledger_core_PreferencesBackend_00024CppProxy_native_1unsetEncryption(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
  {
      try {
          DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
          const auto& ref = ::djinni::objectFromHandleAddress<::ledger::core::api::PreferencesBackend>(nativeRef);
          ref->unsetEncryption();
      } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
  }
  
  CJNIEXPORT jboolean JNICALL Java_co_ledger_core_PreferencesBackend_00024CppProxy_native_1resetEncryption(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_rng, jstring j_oldPassword, jstring j_newPassword)
  {
      try {
          DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
          const auto& ref = ::djinni::objectFromHandleAddress<::ledger::core::api::PreferencesBackend>(nativeRef);
          auto r = ref->resetEncryption(::djinni_generated::RandomNumberGenerator::toCpp(jniEnv, j_rng),
                                        ::djinni::String::toCpp(jniEnv, j_oldPassword),
                                        ::djinni::String::toCpp(jniEnv, j_newPassword));
          return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r));
      } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
  }
  
  CJNIEXPORT jstring JNICALL Java_co_ledger_core_PreferencesBackend_00024CppProxy_native_1getEncryptionSalt(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
  {
      try {
          DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
          const auto& ref = ::djinni::objectFromHandleAddress<::ledger::core::api::PreferencesBackend>(nativeRef);
          auto r = ref->getEncryptionSalt();
          return ::djinni::release(::djinni::String::fromCpp(jniEnv, r));
      } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
  }
  
  CJNIEXPORT void JNICALL Java_co_ledger_core_PreferencesBackend_00024CppProxy_native_1clear(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
  {
      try {
          DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
          const auto& ref = ::djinni::objectFromHandleAddress<::ledger::core::api::PreferencesBackend>(nativeRef);
          ref->clear();
      } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
  }
  
  }  // namespace djinni_generated
  