File: jp_jniutil.h

package info (click to toggle)
python-jpype 0.6.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,560 kB
  • sloc: cpp: 11,957; python: 3,844; java: 986; ansic: 875; makefile: 149; xml: 76; sh: 62
file content (190 lines) | stat: -rw-r--r-- 4,636 bytes parent folder | download
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*****************************************************************************
   Copyright 2004 Steve Ménard

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

*****************************************************************************/
#ifndef _JPJNIUTIL_H_
#define _JPJNIUTIL_H_

namespace JPJni
{
	extern jclass s_ClassClass;
	extern jclass s_StringClass;
	extern jclass s_NoSuchMethodErrorClass;
	extern jclass s_RuntimeExceptionClass;
	extern jclass s_ProxyClass;
	extern jmethodID s_NewProxyInstanceID;

	extern jlong s_minByte;
	extern jlong s_maxByte;
	extern jlong s_minShort;
	extern jlong s_maxShort;
	extern jlong s_minInt;
	extern jlong s_maxInt;
	extern jfloat s_minFloat;
	extern jfloat s_maxFloat;

	void init();

	void startJPypeReferenceQueue(bool);
	void stopJPypeReferenceQueue();
	void registerRef(jobject refQueue, jobject obj, jlong hostRef);

	string asciiFromJava(jstring str);
	JCharString unicodeFromJava(jstring str);

	jstring javaStringFromJCharString(JCharString& str);

	JPTypeName getClassName(jobject obj);
	jclass getClass(jobject obj);
	jstring toString(jobject obj);

	/**
	* java.lang.Class.isInterface()
	*/
	bool            isInterface(jclass);

	/**
	* java.lang.reflect.Modifier.isAbstract(java.lang.Class.getModifiers()
	*/
	bool            isAbstract(jclass);

	/**
	* java.lang.reflect.Modifier.isFinal(java.lang.Class.getModifiers()
	*/
	bool            isFinal(jclass);

	/**
	* java.lang.Class.getName()
	*/
	JPTypeName      getName(jclass);

	/**
	* java.lang.Class.getInterfaces()
	*/
	vector<jclass>  getInterfaces(JPLocalFrame& frame, jclass);

	/**
	* java.lang.Class.getDeclaredFields()
	*/
	vector<jobject> getDeclaredFields(JPLocalFrame& frame, jclass);


	/**
	* java.lang.Class.getConstructors()
	*/
	vector<jobject> getConstructors(JPLocalFrame& frame, jclass);

	/**
	* java.lang.Class.getFields()
	*/
	vector<jobject> getFields(JPLocalFrame& frame, jclass);

	/**
	* java.lang.Class.getDeclaredMethods()
	*/
	vector<jobject> getDeclaredMethods(JPLocalFrame& frame, jclass);

	/**
	* java.lang.Class.getDeclaredMethods()
	*/
	vector<jobject> getMethods(JPLocalFrame& frame, jclass);

	/**
	* java.lang.Class.getDeclaredMethods()
	*/
	vector<jobject> getDeclaredConstructors(JPLocalFrame& frame, jclass);

	/**
	* java.lang.Class.getModifiers()
	*/
	long getClassModifiers(jclass);

	jobject getSystemClassLoader();

	/**
	* java.lang.reflect.Member.getName()
	*/
	string getMemberName(jobject);

	/**
	* java.lang.reflect.Modifier.isPublic(java.lang.reflect.member.getModifiers())
	*/
	bool isMemberPublic(jobject);

	/**
	* java.lang.reflect.Modifier.is(java.lang.reflect.member.getModifiers())
	*/
	bool isMemberStatic(jobject);

	/**
	* java.lang.reflect.Modifier.isFinal(java.lang.reflect.member.getModifiers())
	*/
	bool isMemberFinal(jobject);

	/**
	* java.lang.reflect.Modifier.isAbstract(java.lang.reflect.member.getModifiers())
	*/
	bool isMemberAbstract(jobject);

	/**
	* java.lang.reflect.Field.getType
	*/
	JPTypeName getType(jobject fld);

	/**
	* java.lang.reflect.Method.getReturnType
	*/
	JPTypeName getReturnType(jobject);

	/**
	* java.lang.reflect.Method.isSynthetic()
	*/
	bool isMethodSynthetic(jobject);

	/**
	* java.lang.reflect.Method.isSynthetic()
	*/
	bool isVarArgsMethod(jobject);

	jint hashCode(jobject);

	/**
	* java.lang.reflect.Method.getParameterTypes
	*/
	vector<JPTypeName> getParameterTypes(jobject, bool);

	bool isConstructor(jobject);
	string getStackTrace(jthrowable th);
	string getMessage(jthrowable th);
	bool isThrowable(jclass c);

	long intValue(jobject);
	jlong longValue(jobject);
	double doubleValue(jobject);
	bool booleanValue(jobject);
	jchar charValue(jobject);

	jclass getByteClass();
	jclass getShortClass();
	jclass getIntegerClass();
	jclass getLongClass();
	jclass getFloatClass();
	jclass getDoubleClass();
	jclass getCharacterClass();
	jclass getBooleanClass();
	jclass getVoidClass();
};

#endif // _JPJNIUTIL_H_