-
Notifications
You must be signed in to change notification settings - Fork 0
/
jni-reflection.scm
63 lines (55 loc) · 2.77 KB
/
jni-reflection.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;; jni-reflection: high level java procedures
(define Class.isPrimitive
(jlambda-method #f boolean java.lang.Class isPrimitive))
(define Class.getFields
(jlambda-method #f #(java.lang.reflect.Field) java.lang.Class getFields))
(define Class.getDeclaredFields
(jlambda-method #f #(java.lang.reflect.Field) java.lang.Class getDeclaredFields))
(define Class.getMethod
(jlambda-method #f java.lang.reflect.Method java.lang.Class getMethod java.lang.String #(java.lang.Class)))
(define Class.getMethods
(jlambda-method #f #(java.lang.reflect.Method) java.lang.Class getMethods))
(define Class.getConstructors
(jlambda-method #f #(java.lang.reflect.Constructor) java.lang.Class getConstructors))
(define Class.getDeclaredMethods
(jlambda-method #f #(java.lang.reflect.Method) java.lang.Class getDeclaredMethods))
(define Field.getName
(jlambda-method #f java.lang.String java.lang.reflect.Field getName))
(define Field.getType
(jlambda-method #f java.lang.Class java.lang.reflect.Field getType))
(define Field.getModifiers
(jlambda-method #f int java.lang.reflect.Field getModifiers))
(define Method.invoke
(jlambda-method #f java.lang.Object java.lang.reflect.Method invoke java.lang.Object #(java.lang.Object)))
(define Method.getModifiers
(jlambda-method #f int java.lang.reflect.Method getModifiers))
(define Method.getReturnType
(jlambda-method #f java.lang.Class java.lang.reflect.Method getReturnType))
(define Method.getName
(jlambda-method #f java.lang.String java.lang.reflect.Method getName))
(define Method.getParameterTypes
(jlambda-method #f #(java.lang.Class) java.lang.reflect.Method getParameterTypes))
(define Constructor.getParameterTypes
(jlambda-method #f #(java.lang.Class) java.lang.reflect.Constructor getParameterTypes))
(define find-field/helper
(let ((find (jlambda-method (static) java.lang.reflect.Field
com.chicken_mobile.jni.ReflectionHelper findField java.lang.Class java.lang.String)))
(lambda (class name)
(let* ((name (jstring name))
(r (find class name)))
(delete-local-ref name)
r))))
(define find-methods-by-name/helper
(let ((find (jlambda-method (static) #(java.lang.reflect.Method)
com.chicken_mobile.jni.ReflectionHelper findMethodsByName java.lang.Class java.lang.String)))
(lambda (class name)
(let* ((name (jstring name))
(r (find class name)))
(delete-local-ref name)
r))))
(define find-methods/helper
(jlambda-method (static) #(java.lang.reflect.Method)
com.chicken_mobile.jni.ReflectionHelper findMethods java.lang.Class))
(define find-fields/helper
(jlambda-method (static) #(java.lang.reflect.Field)
com.chicken_mobile.jni.ReflectionHelper findFields java.lang.Class))