34 return reinterpret_cast<void**
>(env);
75 const std::vector<std::string>& options = std::vector<std::string>(),
77 bool exceptions =
false);
80 static bool created();
95 static const Class named(
const std::string&
name);
100 const Class arrayOf()
const;
113 Class(
const std::string& name,
bool native =
true);
115 std::string signature()
const;
138 std::vector<Class> parameters;
179 const std::string
name;
180 std::vector<Class> parameters;
195 const std::string&
name,
196 const Class& returnType,
197 const std::vector<Class>& parameters);
200 const std::string
name;
201 const Class returnType;
202 std::vector<Class> parameters;
250 : object(
Jvm::
get()->newGlobalRef(_object)) {}
255 if (that.
object !=
nullptr) {
262 if (
object !=
nullptr) {
263 Jvm::get()->deleteGlobalRef(
object);
269 if (
object !=
nullptr) {
270 Jvm::get()->deleteGlobalRef(
object);
273 if (that.
object !=
nullptr) {
279 operator jobject()
const 294 template <
typename T, const
char* name, const
char* signature>
302 { T* t =
nullptr;
Object* o = t; (void) o; }
306 : clazz(_clazz), object(_object)
309 { T* t =
nullptr;
Object* o = t; (void) o; }
315 template <
typename U>
320 { U* u =
nullptr;
Object* o = u; (void) o; }
346 template <
typename T, const
char* name, const
char* signature>
354 { T* t =
nullptr;
Object* o = t; (void) o; }
384 explicit Env(
bool daemon =
true);
389 operator JNIEnv*()
const {
return env; }
409 jstring string(
const std::string& s);
419 const std::string&
name,
420 const std::string& signature);
422 Field findStaticField(
424 const std::string&
name,
425 const std::string& signature);
433 template <
typename T>
434 T invoke(
const jobject receiver,
const Method method, ...);
436 template <
typename T>
437 T invokeStatic(
const Method method, ...);
439 template <
typename T>
440 void setField(jobject receiver,
const Field& field, T t);
442 template <
typename T>
443 T getStaticField(
const Field& field);
446 void check(JNIEnv* env);
455 jobject newGlobalRef(
const jobject
object);
456 void deleteGlobalRef(
const jobject
object);
458 jclass findClass(
const Class& clazz);
461 const std::string&
name,
463 const std::vector<Jvm::Class>& argTypes,
466 template <
typename T>
467 T invokeV(
const jobject receiver,
const jmethodID
id, va_list args);
469 template <
typename T>
470 T invokeStaticV(
const Class& receiver,
const jmethodID
id, va_list args);
473 static Jvm* instance;
477 const bool exceptions;
482 void Jvm::invoke<void>(
const jobject receiver,
const Method method, ...);
485 template <
typename T>
489 va_start(args, method);
490 const T result = invokeV<T>(receiver, method.id, args);
497 void Jvm::invokeStatic<void>(
const Method method, ...);
500 template <
typename T>
504 va_start(args, method);
505 const T result = invokeStaticV<T>(method.clazz, method.id, args);
510 #endif // __JVM_HPP__ Version
Definition: jvm.hpp:40
Try< std::vector< std::string > > get(const std::string &hierarchy, const std::string &cgroup="/")
const Class booleanClass
Definition: jvm.hpp:399
Object & operator=(const Object &that)
Definition: jvm.hpp:267
const Class floatClass
Definition: jvm.hpp:405
const Class voidClass
Definition: jvm.hpp:398
const Class intClass
Definition: jvm.hpp:403
Object(jobject _object)
Definition: jvm.hpp:249
void bind(const Object &_object)
Definition: jvm.hpp:332
const Class doubleClass
Definition: jvm.hpp:406
process::Future< Version > version()
Definition: version.hpp:32
Object(const Object &that)
Definition: jvm.hpp:252
Variable(const Class &_clazz, const Object &_object)
Definition: jvm.hpp:305
Field findField(const Class &clazz, const std::string &name, const std::string &signature)
Variable(const Class &_clazz)
Definition: jvm.hpp:298
jobject object
Definition: jvm.hpp:287
T invokeStatic(const Method method,...)
Definition: jvm.hpp:501
void setField(jobject receiver, const Field &field, T t)
const Class shortClass
Definition: jvm.hpp:402
Field findStaticField(const Class &clazz, const std::string &name, const std::string &signature)
void ** JNIENV_CAST(JNIEnv **env)
Definition: jvm.hpp:32
JNIEnv * operator->() const
Definition: jvm.hpp:387
Definition: version.hpp:41
StaticVariable(const Class &_clazz)
Definition: jvm.hpp:350
Try< uint32_t > type(const std::string &path)
const Class byteClass
Definition: jvm.hpp:400
jobject invoke(const Constructor ctor,...)
Variable & operator=(const U &u)
Definition: jvm.hpp:316
Try< Nothing > create(const std::string &hierarchy, const std::string &cgroup, bool recursive=false)
const Class stringClass
Definition: jvm.hpp:407
~Object()
Definition: jvm.hpp:260
const Class charClass
Definition: jvm.hpp:401
const Class longClass
Definition: jvm.hpp:404
Object()
Definition: jvm.hpp:247
T getStaticField(const Field &field)
constexpr const char * name
Definition: shell.hpp:41
Class
Definition: elf.hpp:38