| 31 | } |
| 32 | |
| 33 | Valdi::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 | |
| 51 | void JavaEnumClassDelegate::setEnumCase(size_t index, const JavaValue& javaValue) { |
| 52 | Valdi::InlineContainerAllocator<JavaEnumClassDelegate, IndirectJavaGlobalRef> allocator; |
no test coverage detected