| 701 | } |
| 702 | |
| 703 | auto isSuccess = JavaEnv::getCache().getValdiResultIsSuccessMethod().call(javaResult); |
| 704 | if (isSuccess) { |
| 705 | auto successValue = JavaEnv::getCache().getValdiResultGetSuccessValueMethod().call(javaResult); |
| 706 | return toValue(env, successValue.stealLocalRef()); |
| 707 | } else { |
| 708 | auto errorMessage = JavaEnv::getCache().getValdiResultGetErrorMessageMethod().call(javaResult); |
| 709 | return Valdi::Error(toInternedString(env, errorMessage)); |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | JavaObject javaResultFromPlatformResult(JavaEnv env, const Valdi::PlatformResult& platformResult) { |
| 714 | if (platformResult) { |
| 715 | if (platformResult.value().isNullOrUndefined()) { |
| 716 | // Success with no values are represented as null objects to avoid JNI calls in the good cases. |
| 717 | return JavaObject(env); |
| 718 | } |
| 719 | |
| 720 | auto convertedValue = toJavaObject(env, platformResult.value()); |
| 721 | return JavaEnv::getCache().getValdiResultSuccessMethod().call( |
no test coverage detected