1 // Copyright © 2021-present 650 Industries, Inc. (aka Expo)
2 
3 #pragma once
4 
5 #include "CppType.h"
6 #include <fbjni/fbjni.h>
7 
8 namespace jni = facebook::jni;
9 
10 namespace expo {
11 
12 class ExpectedType;
13 
14 /**
15  * A C++ representation of the [expo.modules.kotlin.jni.SingleType] class.
16  */
17 class SingleType : public jni::JavaClass<SingleType> {
18 public:
19   static auto constexpr
20     kJavaDescriptor = "Lexpo/modules/kotlin/jni/SingleType;";
21 
22   CppType getCppType();
23 
24   jni::local_ref<jni::JavaClass<ExpectedType>::javaobject> getFirstParameterType();
25 
26   jni::local_ref<jni::JavaClass<ExpectedType>::javaobject> getSecondParameterType();
27 };
28 
29 /**
30  * A C++ representation of the [expo.modules.kotlin.jni.ExpectedType] class.
31  */
32 class ExpectedType : public jni::JavaClass<ExpectedType> {
33 public:
34   static auto constexpr
35     kJavaDescriptor = "Lexpo/modules/kotlin/jni/ExpectedType;";
36 
37   CppType getCombinedTypes();
38 
39   jni::local_ref<SingleType::javaobject> getFirstType();
40 
41   /**
42    * Converts [ExpectedType] to a string representing a java class.
43    * If the allowsPrimitives is set to true type like int will be represented as a primitives.
44    */
45   std::string getJClassString(bool allowsPrimitives = false);
46 
47   jni::local_ref<jni::JArrayClass<SingleType>::javaobject> getPossibleTypes();
48 };
49 } // namespace expo
50