-
Notifications
You must be signed in to change notification settings - Fork 13
/
JniJavaField.cpp
134 lines (112 loc) · 5.97 KB
/
JniJavaField.cpp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include <JniJavaField.h>
namespace JNI {
jboolean JavaFieldHelper<jboolean>::Get(const JavaField<T>& self) {
return self.Env().Val()->GetBooleanField(self.GetObject().Val(), self.Val());
}
void JavaFieldHelper<jboolean>::Set(const JavaField<T>& self, T&& val) {
self.Env().Val()->SetBooleanField(self.GetObject().Val(), self.Val(), std::forward<T>(val));
}
jchar JavaFieldHelper<jchar>::Get(const JavaField<T>& self) {
return self.Env().Val()->GetCharField(self.GetObject().Val(), self.Val());
}
void JavaFieldHelper<jchar>::Set(const JavaField<T>& self, T&& val) {
self.Env().Val()->SetCharField(self.GetObject().Val(), self.Val(), std::forward<T>(val));
}
jbyte JavaFieldHelper<jbyte>::Get(const JavaField<T>& self) {
return self.Env().Val()->GetByteField(self.GetObject().Val(), self.Val());
}
void JavaFieldHelper<jbyte>::Set(const JavaField<T>& self, T&& val) {
self.Env().Val()->SetByteField(self.GetObject().Val(), self.Val(), std::forward<T>(val));
}
jshort JavaFieldHelper<jshort>::Get(const JavaField<T>& self) {
return self.Env().Val()->GetShortField(self.GetObject().Val(), self.Val());
}
void JavaFieldHelper<jshort>::Set(const JavaField<T>& self, T&& val) {
self.Env().Val()->SetShortField(self.GetObject().Val(), self.Val(), std::forward<T>(val));
}
jint JavaFieldHelper<jint>::Get(const JavaField<T>& self) {
return self.Env().Val()->GetIntField(self.GetObject().Val(), self.Val());
}
void JavaFieldHelper<jint>::Set(const JavaField<T>& self, T&& val) {
self.Env().Val()->SetIntField(self.GetObject().Val(), self.Val(), std::forward<T>(val));
}
// TestJniInt JavaFieldHelper<TestJniInt>::Get(const JavaField<T>& self) {
// return FromJavaProxy<T>(self.Env(), self.Env().Val()->GetIntField(self.GetObject().Val(), self.Val())).Val();
// }
// void JavaFieldHelper<TestJniInt>::Set(const JavaField<T>& self, T&& val) {
// self.Env().Val()->SetIntField(self.GetObject().Val(), self.Val(), ToJavaProxy<T>(self.Env(), std::forward<T>(val)).Val());
// }
jlong JavaFieldHelper<jlong>::Get(const JavaField<T>& self) {
return self.Env().Val()->GetLongField(self.GetObject().Val(), self.Val());
}
void JavaFieldHelper<jlong>::Set(const JavaField<T>& self, T&& val) {
self.Env().Val()->SetLongField(self.GetObject().Val(), self.Val(), std::forward<T>(val));
}
jfloat JavaFieldHelper<jfloat>::Get(const JavaField<T>& self) {
return self.Env().Val()->GetFloatField(self.GetObject().Val(), self.Val());
}
void JavaFieldHelper<jfloat>::Set(const JavaField<T>& self, T&& val) {
self.Env().Val()->SetFloatField(self.GetObject().Val(), self.Val(), std::forward<T>(val));
}
jdouble JavaFieldHelper<jdouble>::Get(const JavaField<T>& self) {
return self.Env().Val()->GetDoubleField(self.GetObject().Val(), self.Val());
}
void JavaFieldHelper<jdouble>::Set(const JavaField<T>& self, T&& val) {
self.Env().Val()->SetDoubleField(self.GetObject().Val(), self.Val(), std::forward<T>(val));
}
/////////////////////////
jboolean JavaStaticFieldHelper<jboolean>::Get(const JavaStaticField<T>& self) {
return self.Env().Val()->GetStaticBooleanField(self.GetClass().Val(), self.Val());
}
void JavaStaticFieldHelper<jboolean>::Set(const JavaStaticField<T>& self, T&& val) {
self.Env().Val()->SetStaticBooleanField(self.GetClass().Val(), self.Val(), std::forward<T>(val));
}
jchar JavaStaticFieldHelper<jchar>::Get(const JavaStaticField<T>& self) {
return self.Env().Val()->GetStaticCharField(self.GetClass().Val(), self.Val());
}
void JavaStaticFieldHelper<jchar>::Set(const JavaStaticField<T>& self, T&& val) {
self.Env().Val()->SetStaticCharField(self.GetClass().Val(), self.Val(), std::forward<T>(val));
}
jbyte JavaStaticFieldHelper<jbyte>::Get(const JavaStaticField<T>& self) {
return self.Env().Val()->GetStaticByteField(self.GetClass().Val(), self.Val());
}
void JavaStaticFieldHelper<jbyte>::Set(const JavaStaticField<T>& self, T&& val) {
self.Env().Val()->SetStaticByteField(self.GetClass().Val(), self.Val(), std::forward<T>(val));
}
jshort JavaStaticFieldHelper<jshort>::Get(const JavaStaticField<T>& self) {
return self.Env().Val()->GetStaticShortField(self.GetClass().Val(), self.Val());
}
void JavaStaticFieldHelper<jshort>::Set(const JavaStaticField<T>& self, T&& val) {
self.Env().Val()->SetStaticShortField(self.GetClass().Val(), self.Val(), std::forward<T>(val));
}
jint JavaStaticFieldHelper<jint>::Get(const JavaStaticField<T>& self) {
return self.Env().Val()->GetStaticIntField(self.GetClass().Val(), self.Val());
}
void JavaStaticFieldHelper<jint>::Set(const JavaStaticField<T>& self, T&& val) {
self.Env().Val()->SetStaticIntField(self.GetClass().Val(), self.Val(), std::forward<T>(val));
}
// TestJniInt JavaStaticFieldHelper<TestJniInt>::Get(const JavaStaticField<T>& self) {
// return FromJavaProxy<T>(self.Env(), self.Env().Val()->GetStaticIntField(self.GetClass().Val(), self.Val())).Val();
// }
// void JavaStaticFieldHelper<TestJniInt>::Set(const JavaStaticField<T>& self, T&& val) {
// self.Env().Val()->SetStaticIntField(self.GetClass().Val(), self.Val(), ToJavaProxy<T>(self.Env(), std::forward<T>(val)).Val());
// }
jlong JavaStaticFieldHelper<jlong>::Get(const JavaStaticField<T>& self) {
return self.Env().Val()->GetStaticLongField(self.GetClass().Val(), self.Val());
}
void JavaStaticFieldHelper<jlong>::Set(const JavaStaticField<T>& self, T&& val) {
self.Env().Val()->SetStaticLongField(self.GetClass().Val(), self.Val(), std::forward<T>(val));
}
jfloat JavaStaticFieldHelper<jfloat>::Get(const JavaStaticField<T>& self) {
return self.Env().Val()->GetStaticFloatField(self.GetClass().Val(), self.Val());
}
void JavaStaticFieldHelper<jfloat>::Set(const JavaStaticField<T>& self, T&& val) {
self.Env().Val()->SetStaticFloatField(self.GetClass().Val(), self.Val(), std::forward<T>(val));
}
jdouble JavaStaticFieldHelper<jdouble>::Get(const JavaStaticField<T>& self) {
return self.Env().Val()->GetStaticDoubleField(self.GetClass().Val(), self.Val());
}
void JavaStaticFieldHelper<jdouble>::Set(const JavaStaticField<T>& self, T&& val) {
self.Env().Val()->SetStaticDoubleField(self.GetClass().Val(), self.Val(), std::forward<T>(val));
}
}