PyLucene 3.4.0-1 import
[pylucene.git] / jcc / _jcc / java / lang / reflect / Type.cpp
1 #ifdef _java_generics
2
3 #include <jni.h>
4 #include "JCCEnv.h"
5 #include "java/lang/reflect/Type.h"
6 #include "java/lang/Class.h"
7 #include "JArray.h"
8
9 namespace java {
10     namespace lang {
11         namespace reflect {
12
13             java::lang::Class *Type::class$ = NULL;
14             jmethodID *Type::mids$ = NULL;
15
16             jclass Type::initializeClass()
17             {
18                 if (!class$)
19                 {
20
21                     jclass cls = (jclass) env->findClass("java/lang/reflect/Type");
22
23                     class$ = (java::lang::Class *) new JObject(cls);
24                 }
25                 return (jclass) class$->this$;
26             }
27         }
28     }
29 }
30
31 #include "structmember.h"
32 #include "functions.h"
33 #include "macros.h"
34
35 namespace java {
36     namespace lang {
37         namespace reflect {
38             static PyObject *t_Type_cast_(PyTypeObject *type, PyObject *arg);
39             static PyObject *t_Type_instance_(PyTypeObject *type, PyObject *arg);
40
41             static PyMethodDef t_Type__methods_[] = {
42                 DECLARE_METHOD(t_Type, cast_, METH_O | METH_CLASS),
43                 DECLARE_METHOD(t_Type, instance_, METH_O | METH_CLASS),
44                 { NULL, NULL, 0, NULL }
45             };
46
47             DECLARE_TYPE(Type, t_Type, java::lang::Object, Type, abstract_init, 0, 0, 0, 0, 0);
48
49             static PyObject *t_Type_cast_(PyTypeObject *type, PyObject *arg)
50             {
51                 if (!(arg = castCheck(arg, Type::initializeClass, 1)))
52                     return NULL;
53                 return t_Type::wrap_Object(Type(((t_Type *) arg)->object.this$));
54             }
55             static PyObject *t_Type_instance_(PyTypeObject *type, PyObject *arg)
56             {
57                 if (!castCheck(arg, Type::initializeClass, 0))
58                     Py_RETURN_FALSE;
59                 Py_RETURN_TRUE;
60             }
61         }
62     }
63 }
64
65 #endif /* _java_generics */