PyLucene 3.4.0-1 import
[pylucene.git] / jcc / _jcc / java / lang / reflect / TypeVariable.cpp
1 #ifdef _java_generics
2
3 #include <jni.h>
4 #include "JCCEnv.h"
5 #include "java/lang/reflect/TypeVariable.h"
6 #include "java/lang/reflect/GenericDeclaration.h"
7 #include "java/lang/Class.h"
8 #include "java/lang/String.h"
9 #include "JArray.h"
10
11 namespace java {
12     namespace lang {
13         namespace reflect {
14
15             java::lang::Class *TypeVariable::class$ = NULL;
16             jmethodID *TypeVariable::mids$ = NULL;
17
18             jclass TypeVariable::initializeClass()
19             {
20                 if (!class$)
21                 {
22
23                     jclass cls = (jclass) env->findClass("java/lang/reflect/TypeVariable");
24
25                     mids$ = new jmethodID[max_mid];
26                     mids$[mid_getBounds_6f565a00] = env->getMethodID(cls, "getBounds", "()[Ljava/lang/reflect/Type;");
27                     mids$[mid_getGenericDeclaration_2dc62edd] = env->getMethodID(cls, "getGenericDeclaration", "()Ljava/lang/reflect/GenericDeclaration;");
28                     mids$[mid_getName_14c7b5c5] = env->getMethodID(cls, "getName", "()Ljava/lang/String;");
29
30                     class$ = (java::lang::Class *) new JObject(cls);
31                 }
32                 return (jclass) class$->this$;
33             }
34
35             JArray<java::lang::reflect::Type> TypeVariable::getBounds() const
36             {
37                 return JArray<java::lang::reflect::Type>(env->callObjectMethod(this$, mids$[mid_getBounds_6f565a00]));
38             }
39
40             java::lang::reflect::GenericDeclaration TypeVariable::getGenericDeclaration() const
41             {
42                 return java::lang::reflect::GenericDeclaration(env->callObjectMethod(this$, mids$[mid_getGenericDeclaration_2dc62edd]));
43             }
44
45             java::lang::String TypeVariable::getName() const
46             {
47                 return java::lang::String(env->callObjectMethod(this$, mids$[mid_getName_14c7b5c5]));
48             }
49         }
50     }
51 }
52
53 #include "structmember.h"
54 #include "functions.h"
55 #include "macros.h"
56
57 namespace java {
58     namespace lang {
59         namespace reflect {
60             static PyObject *t_TypeVariable_cast_(PyTypeObject *type, PyObject *arg);
61             static PyObject *t_TypeVariable_instance_(PyTypeObject *type, PyObject *arg);
62             static PyObject *t_TypeVariable_getBounds(t_TypeVariable *self);
63             static PyObject *t_TypeVariable_getGenericDeclaration(t_TypeVariable *self);
64             static PyObject *t_TypeVariable_getName(t_TypeVariable *self);
65
66             static PyMethodDef t_TypeVariable__methods_[] = {
67                 DECLARE_METHOD(t_TypeVariable, cast_, METH_O | METH_CLASS),
68                 DECLARE_METHOD(t_TypeVariable, instance_, METH_O | METH_CLASS),
69                 DECLARE_METHOD(t_TypeVariable, getBounds, METH_NOARGS),
70                 DECLARE_METHOD(t_TypeVariable, getGenericDeclaration, METH_NOARGS),
71                 DECLARE_METHOD(t_TypeVariable, getName, METH_NOARGS),
72                 { NULL, NULL, 0, NULL }
73             };
74
75             DECLARE_TYPE(TypeVariable, t_TypeVariable, java::lang::reflect::Type, TypeVariable, abstract_init, 0, 0, 0, 0, 0);
76
77             static PyObject *t_TypeVariable_cast_(PyTypeObject *type, PyObject *arg)
78             {
79                 if (!(arg = castCheck(arg, TypeVariable::initializeClass, 1)))
80                     return NULL;
81                 return t_TypeVariable::wrap_Object(TypeVariable(((t_TypeVariable *) arg)->object.this$));
82             }
83             static PyObject *t_TypeVariable_instance_(PyTypeObject *type, PyObject *arg)
84             {
85                 if (!castCheck(arg, TypeVariable::initializeClass, 0))
86                     Py_RETURN_FALSE;
87                 Py_RETURN_TRUE;
88             }
89
90             static PyObject *t_TypeVariable_getBounds(t_TypeVariable *self)
91             {
92                 JArray<java::lang::reflect::Type> result((jobject) NULL);
93                 OBJ_CALL(result = self->object.getBounds());
94
95                 return result.toSequence(t_Type::wrap_Object);
96             }
97
98             static PyObject *t_TypeVariable_getGenericDeclaration(t_TypeVariable *self)
99             {
100                 java::lang::reflect::GenericDeclaration result((jobject) NULL);
101                 OBJ_CALL(result = self->object.getGenericDeclaration());
102                 return java::lang::reflect::t_GenericDeclaration::wrap_Object(result);
103             }
104
105             static PyObject *t_TypeVariable_getName(t_TypeVariable *self)
106             {
107                 java::lang::String result((jobject) NULL);
108                 OBJ_CALL(result = self->object.getName());
109                 return j2p(result);
110             }
111         }
112     }
113 }
114
115 #endif /* _java_generics */