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

Method enumCaseToValue

valdi/src/valdi/android/JavaEnumClassDelegate.cpp:33–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33Valdi::Value JavaEnumClassDelegate::enumCaseToValue(const JavaValue& enumeration,
34 bool /*isBoxed*/,
35 Valdi::ExceptionTracker& exceptionTracker) {
36 size_t index = 0;
37 auto* jEnumeration = enumeration.getObject();
38 for (const auto& enumCase : *_enumSchema) {
39 auto javaEnumCase = getEnumCase(index);
40 if (JavaEnv::isSameObject(jEnumeration, javaEnumCase.getObject())) {
41 return enumCase.value;
42 }
43
44 index++;
45 }
46
47 exceptionTracker.onError(Valdi::Error("Could not resolve enum value"));
48 return Valdi::Value();
49}
50
51void JavaEnumClassDelegate::setEnumCase(size_t index, const JavaValue& javaValue) {
52 Valdi::InlineContainerAllocator<JavaEnumClassDelegate, IndirectJavaGlobalRef> allocator;

Callers 2

marshallMethod · 0.45
getEnumValueMethod · 0.45

Calls 5

isSameObjectFunction · 0.85
getObjectMethod · 0.65
onErrorMethod · 0.65
ErrorInterface · 0.50
ValueClass · 0.50

Tested by

no test coverage detected