MCPcopy Create free account
hub / github.com/Snapchat/Valdi / javaResultFromPlatformResult

Function javaResultFromPlatformResult

valdi_core/src/valdi_core/jni/JavaUtils.cpp:703–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

701}
702
703JavaObject javaResultFromPlatformResult(JavaEnv env, const Valdi::PlatformResult& platformResult) {
704 if (platformResult) {
705 if (platformResult.value().isNullOrUndefined()) {
706 // Success with no values are represented as null objects to avoid JNI calls in the good cases.
707 return JavaObject(env);
708 }
709
710 auto convertedValue = toJavaObject(env, platformResult.value());
711 return JavaEnv::getCache().getValdiResultSuccessMethod().call(
712 JavaEnv::getCache().getValdiResultClass().getClass(), convertedValue);
713 } else {
714 auto convertedError = toJavaObject(env, platformResult.error().getMessage());
715 return JavaEnv::getCache().getValdiResultFailureMethod().call(
716 JavaEnv::getCache().getValdiResultClass().getClass(), convertedError);
717 }
718}
719
720ValdiContext fromValdiContextUserData(const Valdi::SharedValdiObject& userData) {
721 return typedJavaObjectFromValdiObject<ValdiContext>(userData, false);

Callers 1

fromCppMethod · 0.85

Calls 8

toJavaObjectFunction · 0.85
JavaObjectClass · 0.70
valueMethod · 0.65
callMethod · 0.65
getMessageMethod · 0.65
errorMethod · 0.65
isNullOrUndefinedMethod · 0.45
getClassMethod · 0.45

Tested by

no test coverage detected