1 /*
2 * Copyright (C) 2008 - 2011 Vivien Malerba <malerba@gnome-db.org>
3 * Copyright (C) 2010 David King <davidk@openismus.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #include "GdaJColumnInfos.h"
22 #include "jni-wrapper.h"
23
24 JniWrapperField *GdaJColumnInfos__col_name = NULL;
25 JniWrapperField *GdaJColumnInfos__col_descr = NULL;
26 JniWrapperField *GdaJColumnInfos__col_type = NULL;
27
28 JNIEXPORT void
Java_GdaJColumnInfos_initIDs(JNIEnv * env,jclass klass)29 JNICALL Java_GdaJColumnInfos_initIDs (JNIEnv *env, jclass klass)
30 {
31 gsize i;
32 typedef struct {
33 const gchar *name;
34 const gchar *sig;
35 gboolean is_static;
36 JniWrapperField **symbol;
37 } FieldSignature;
38
39 FieldSignature fields[] = {
40 {"col_name", "Ljava/lang/String;", FALSE, &GdaJColumnInfos__col_name},
41 {"col_descr", "Ljava/lang/String;", FALSE, &GdaJColumnInfos__col_descr},
42 {"col_type", "I", FALSE, &GdaJColumnInfos__col_type},
43 };
44
45 for (i = 0; i < sizeof (fields) / sizeof (FieldSignature); i++) {
46 FieldSignature *m = & (fields [i]);
47 *(m->symbol) = jni_wrapper_field_create (env, klass, m->name, m->sig, m->is_static, NULL);
48 if (!*(m->symbol))
49 g_error ("Can't find field: %s.%s", "GdaJColumnInfos", m->name);
50 }
51 }
52