MCPcopy Create free account
hub / github.com/NativeScript/android / Init

Method Init

test-app/runtime/src/main/cpp/JType.cpp:100–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void JType::Init(JEnv env, Type type) {
101 switch (type) {
102 case Type::Byte:
103 this->clazz = env.FindClass("java/lang/Byte");
104 this->ctor = env.GetMethodID(this->clazz, "<init>", "(B)V");
105 this->valueMethodId = env.GetMethodID(this->clazz, "byteValue", "()B");
106 break;
107 case Type::Char:
108 this->clazz = env.FindClass("java/lang/Character");
109 this->ctor = env.GetMethodID(this->clazz, "<init>", "(C)V");
110 this->valueMethodId = env.GetMethodID(this->clazz, "charValue", "()C");
111 break;
112 case Type::Boolean:
113 this->clazz = env.FindClass("java/lang/Boolean");
114 this->ctor = env.GetMethodID(this->clazz, "<init>", "(Z)V");
115 this->valueMethodId = env.GetMethodID(this->clazz, "booleanValue", "()Z");
116 break;
117 case Type::Short:
118 this->clazz = env.FindClass("java/lang/Short");
119 this->ctor = env.GetMethodID(this->clazz, "<init>", "(S)V");
120 this->valueMethodId = env.GetMethodID(this->clazz, "shortValue", "()S");
121 break;
122 case Type::Int:
123 this->clazz = env.FindClass("java/lang/Integer");
124 this->ctor = env.GetMethodID(this->clazz, "<init>", "(I)V");
125 this->valueMethodId = env.GetMethodID(this->clazz, "intValue", "()I");
126 break;
127 case Type::Long:
128 this->clazz = env.FindClass("java/lang/Long");
129 this->ctor = env.GetMethodID(this->clazz, "<init>", "(J)V");
130 this->valueMethodId = env.GetMethodID(this->clazz, "longValue", "()J");
131 break;
132 case Type::Float:
133 this->clazz = env.FindClass("java/lang/Float");
134 this->ctor = env.GetMethodID(this->clazz, "<init>", "(F)V");
135 this->valueMethodId = env.GetMethodID(this->clazz, "floatValue", "()F");
136 break;
137 case Type::Double:
138 this->clazz = env.FindClass("java/lang/Double");
139 this->ctor = env.GetMethodID(this->clazz, "<init>", "(D)V");
140 this->valueMethodId = env.GetMethodID(this->clazz, "doubleValue", "()D");
141 break;
142 default:
143 break;
144 }
145}
146
147JType* JType::Byte;
148JType* JType::Char;

Callers 1

EnsureInstanceMethod · 0.45

Calls 2

GetMethodIDMethod · 0.80
FindClassMethod · 0.45

Tested by

no test coverage detected