4 * Various JNI helper functions
6 * Copyright 2006,2007 Martin Quinson, Malek Cherier All right reserved.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the license (GNU LGPL) which comes with this package.
13 #ifndef JXBT_UTILITY_H
14 #define JXBT_UTILITY_H
17 #include "jxbt_utilities.h"
23 /* Search a class and throw an exception if not found */
24 jclass jxbt_get_class(JNIEnv* env, const char*name);
26 /* Search a method in a class and throw an exception if not found
27 (it's ok to to pass a NULL class: it's a noop) */
28 jmethodID jxbt_get_jmethod(JNIEnv* env, jclass class,
29 const char *name,const char *signature);
31 /* Search a field in a class and throw an exception if not found
32 (it's ok to to pass a NULL class: it's a noop) */
33 jfieldID jxbt_get_jfield(JNIEnv* env, jclass class,
34 const char *name, const char *signature);
37 /* Search a method in a class and throw an exception if not found
38 (it's ok to to pass a NULL class: it's a noop) */
39 jmethodID jxbt_get_smethod(JNIEnv* env, const char *classname,
40 const char *name,const char *signature);
42 /* Search a field in a class and throw an exception if not found
43 (it's ok to to pass a NULL class: it's a noop) */
44 jfieldID jxbt_get_sfield(JNIEnv* env, const char *classname,
45 const char *name, const char *signature);
48 /* ***************** */
49 /* EXCEPTION RAISING */
50 /* ***************** */
53 /** Thrown on internal error of this layer, or on problem with JNI */
54 void jxbt_throw_jni(JNIEnv* env, const char* msg);
55 /** Thrown when using an object not bound to a native one where it should, or reverse (kinda JNI issue) */
56 void jxbt_throw_notbound(JNIEnv* env,const char* kind,void *pointer);
58 /** Thrown on error in native MSG code */
59 void jxbt_throw_native(JNIEnv* env, char *msg);
61 /** Thrown if NULL gets used */
62 void jxbt_throw_null(JNIEnv* env,char *msg);
64 /** Thrown on illegal arguments */
65 void jxbt_throw_illegal(JNIEnv* env,char *msg);
66 /** Thrown when looking for an host from name does not lead to anything */
67 void jxbt_throw_host_not_found(JNIEnv* env, const char *invalid_name);
68 /** Thrown when looking for an host from name does not lead to anything */
69 void jxbt_throw_process_not_found(JNIEnv* env, const char *invalid_name);
71 #endif /* ! JXBT_UTILITY_H */