|
14 | 14 |
|
15 | 15 | import JavaTypes |
16 | 16 |
|
| 17 | +extension UInt8: JavaValue { |
| 18 | + public typealias JNIType = jbyte |
| 19 | + |
| 20 | + public static var jvalueKeyPath: WritableKeyPath<jvalue, JNIType> { \.b } |
| 21 | + |
| 22 | + public static var javaType: JavaType { .byte } |
| 23 | + |
| 24 | + /// Retrieve the JNI value. |
| 25 | + public func getJNIValue(in environment: JNIEnvironment) -> JNIType { JNIType(self) } |
| 26 | + |
| 27 | + /// Initialize from a JNI value. |
| 28 | + public init(fromJNI value: JNIType, in environment: JNIEnvironment) { |
| 29 | + self = Self(value) |
| 30 | + } |
| 31 | + |
| 32 | + public static func jniMethodCall( |
| 33 | + in environment: JNIEnvironment |
| 34 | + ) -> ((JNIEnvironment, jobject, jmethodID, UnsafePointer<jvalue>?) -> JNIType) { |
| 35 | + environment.interface.CallByteMethodA |
| 36 | + } |
| 37 | + |
| 38 | + public static func jniFieldGet(in environment: JNIEnvironment) -> JNIFieldGet<JNIType> { |
| 39 | + environment.interface.GetByteField |
| 40 | + } |
| 41 | + |
| 42 | + public static func jniFieldSet(in environment: JNIEnvironment) -> JNIFieldSet<JNIType> { |
| 43 | + environment.interface.SetByteField |
| 44 | + } |
| 45 | + |
| 46 | + public static func jniStaticMethodCall( |
| 47 | + in environment: JNIEnvironment |
| 48 | + ) -> ((JNIEnvironment, jobject, jmethodID, UnsafePointer<jvalue>?) -> JNIType) { |
| 49 | + environment.interface.CallStaticByteMethodA |
| 50 | + } |
| 51 | + |
| 52 | + public static func jniStaticFieldGet(in environment: JNIEnvironment) -> JNIStaticFieldGet<JNIType> { |
| 53 | + environment.interface.GetStaticByteField |
| 54 | + } |
| 55 | + |
| 56 | + public static func jniStaticFieldSet(in environment: JNIEnvironment) -> JNIStaticFieldSet<JNIType> { |
| 57 | + environment.interface.SetStaticByteField |
| 58 | + } |
| 59 | + |
| 60 | + public static func jniNewArray(in environment: JNIEnvironment) -> JNINewArray { |
| 61 | + environment.interface.NewByteArray |
| 62 | + } |
| 63 | + |
| 64 | + public static func jniGetArrayRegion(in environment: JNIEnvironment) -> JNIGetArrayRegion<JNIType> { |
| 65 | + environment.interface.GetByteArrayRegion |
| 66 | + } |
| 67 | + |
| 68 | + public static func jniSetArrayRegion(in environment: JNIEnvironment) -> JNISetArrayRegion<JNIType> { |
| 69 | + environment.interface.SetByteArrayRegion |
| 70 | + } |
| 71 | + |
| 72 | + public static var jniPlaceholderValue: jbyte { |
| 73 | + 0 |
| 74 | + } |
| 75 | +} |
| 76 | + |
17 | 77 | extension Int8: JavaValue { |
18 | 78 | public typealias JNIType = jbyte |
19 | 79 |
|
@@ -170,6 +230,66 @@ extension Int16: JavaValue { |
170 | 230 | } |
171 | 231 | } |
172 | 232 |
|
| 233 | +extension UInt32: JavaValue { |
| 234 | + public typealias JNIType = jint |
| 235 | + |
| 236 | + public static var jvalueKeyPath: WritableKeyPath<jvalue, JNIType> { \.i } |
| 237 | + |
| 238 | + public static var javaType: JavaType { .int } |
| 239 | + |
| 240 | + /// Retrieve the JNI value. |
| 241 | + public func getJNIValue(in environment: JNIEnvironment) -> JNIType { JNIType(self) } |
| 242 | + |
| 243 | + /// Initialize from a JNI value. |
| 244 | + public init(fromJNI value: JNIType, in environment: JNIEnvironment) { |
| 245 | + self = Self(value) |
| 246 | + } |
| 247 | + |
| 248 | + public static func jniMethodCall( |
| 249 | + in environment: JNIEnvironment |
| 250 | + ) -> ((JNIEnvironment, jobject, jmethodID, UnsafePointer<jvalue>?) -> JNIType) { |
| 251 | + environment.interface.CallIntMethodA |
| 252 | + } |
| 253 | + |
| 254 | + public static func jniFieldGet(in environment: JNIEnvironment) -> JNIFieldGet<JNIType> { |
| 255 | + environment.interface.GetIntField |
| 256 | + } |
| 257 | + |
| 258 | + public static func jniFieldSet(in environment: JNIEnvironment) -> JNIFieldSet<JNIType> { |
| 259 | + environment.interface.SetIntField |
| 260 | + } |
| 261 | + |
| 262 | + public static func jniStaticMethodCall( |
| 263 | + in environment: JNIEnvironment |
| 264 | + ) -> ((JNIEnvironment, jobject, jmethodID, UnsafePointer<jvalue>?) -> JNIType) { |
| 265 | + environment.interface.CallStaticIntMethodA |
| 266 | + } |
| 267 | + |
| 268 | + public static func jniStaticFieldGet(in environment: JNIEnvironment) -> JNIStaticFieldGet<JNIType> { |
| 269 | + environment.interface.GetStaticIntField |
| 270 | + } |
| 271 | + |
| 272 | + public static func jniStaticFieldSet(in environment: JNIEnvironment) -> JNIStaticFieldSet<JNIType> { |
| 273 | + environment.interface.SetStaticIntField |
| 274 | + } |
| 275 | + |
| 276 | + public static func jniNewArray(in environment: JNIEnvironment) -> JNINewArray { |
| 277 | + environment.interface.NewIntArray |
| 278 | + } |
| 279 | + |
| 280 | + public static func jniGetArrayRegion(in environment: JNIEnvironment) -> JNIGetArrayRegion<JNIType> { |
| 281 | + environment.interface.GetIntArrayRegion |
| 282 | + } |
| 283 | + |
| 284 | + public static func jniSetArrayRegion(in environment: JNIEnvironment) -> JNISetArrayRegion<JNIType> { |
| 285 | + environment.interface.SetIntArrayRegion |
| 286 | + } |
| 287 | + |
| 288 | + public static var jniPlaceholderValue: jint { |
| 289 | + 0 |
| 290 | + } |
| 291 | +} |
| 292 | + |
173 | 293 | extension Int32: JavaValue { |
174 | 294 | public typealias JNIType = jint |
175 | 295 |
|
@@ -228,6 +348,64 @@ extension Int32: JavaValue { |
228 | 348 | } |
229 | 349 | } |
230 | 350 |
|
| 351 | +extension UInt64: JavaValue { |
| 352 | + public typealias JNIType = jlong |
| 353 | + |
| 354 | + public static var jvalueKeyPath: WritableKeyPath<jvalue, JNIType> { \.j } |
| 355 | + |
| 356 | + public func getJNIValue(in environment: JNIEnvironment) -> JNIType { JNIType(self) } |
| 357 | + |
| 358 | + public init(fromJNI value: JNIType, in environment: JNIEnvironment) { |
| 359 | + self = UInt64(value) |
| 360 | + } |
| 361 | + |
| 362 | + public static var javaType: JavaType { .long } |
| 363 | + |
| 364 | + public static func jniMethodCall( |
| 365 | + in environment: JNIEnvironment |
| 366 | + ) -> ((JNIEnvironment, jobject, jmethodID, UnsafePointer<jvalue>?) -> JNIType) { |
| 367 | + environment.interface.CallLongMethodA |
| 368 | + } |
| 369 | + |
| 370 | + public static func jniFieldGet(in environment: JNIEnvironment) -> JNIFieldGet<JNIType> { |
| 371 | + environment.interface.GetLongField |
| 372 | + } |
| 373 | + |
| 374 | + public static func jniFieldSet(in environment: JNIEnvironment) -> JNIFieldSet<JNIType> { |
| 375 | + environment.interface.SetLongField |
| 376 | + } |
| 377 | + |
| 378 | + public static func jniStaticMethodCall( |
| 379 | + in environment: JNIEnvironment |
| 380 | + ) -> ((JNIEnvironment, jobject, jmethodID, UnsafePointer<jvalue>?) -> JNIType) { |
| 381 | + environment.interface.CallStaticLongMethodA |
| 382 | + } |
| 383 | + |
| 384 | + public static func jniStaticFieldGet(in environment: JNIEnvironment) -> JNIStaticFieldGet<JNIType> { |
| 385 | + environment.interface.GetStaticLongField |
| 386 | + } |
| 387 | + |
| 388 | + public static func jniStaticFieldSet(in environment: JNIEnvironment) -> JNIStaticFieldSet<JNIType> { |
| 389 | + environment.interface.SetStaticLongField |
| 390 | + } |
| 391 | + |
| 392 | + public static func jniNewArray(in environment: JNIEnvironment) -> JNINewArray { |
| 393 | + environment.interface.NewLongArray |
| 394 | + } |
| 395 | + |
| 396 | + public static func jniGetArrayRegion(in environment: JNIEnvironment) -> JNIGetArrayRegion<JNIType> { |
| 397 | + environment.interface.GetLongArrayRegion |
| 398 | + } |
| 399 | + |
| 400 | + public static func jniSetArrayRegion(in environment: JNIEnvironment) -> JNISetArrayRegion<JNIType> { |
| 401 | + environment.interface.SetLongArrayRegion |
| 402 | + } |
| 403 | + |
| 404 | + public static var jniPlaceholderValue: jlong { |
| 405 | + 0 |
| 406 | + } |
| 407 | +} |
| 408 | + |
231 | 409 | extension Int64: JavaValue { |
232 | 410 | public typealias JNIType = jlong |
233 | 411 |
|
|
0 commit comments