Пример #1
0
RHO_GLOBAL void event_delete(const char *id)
{
    JNIEnv *env = jnienv();
    jclass cls = getJNIClass(RHODES_JAVA_CLASS_EVENT_STORE);
    if (!cls) return;
    jmethodID mid = getJNIClassStaticMethod(env, cls, "delete", "(Ljava/lang/String;)Ljava/lang/String;");
    if (!mid) return;

    jhstring jId = rho_cast<jhstring>(env, id);
    jhstring jError = jhstring((jstring)env->CallStaticObjectMethod(cls, mid, jId.get()));

    if (!!jError)
    {
        std::string error = rho_cast<std::string>(env, jError.get());
        rb_raise(rb_eRuntimeError, "Event delete failed: %s", error.c_str());
    }
}
Пример #2
0
jhstring jcast_helper<jhstring, const char *>::cast(const char *s)
{
    JNIEnv *env = jnienv();
    jstring obj = env->NewStringUTF(s);
    return jhstring(obj);
}
Пример #3
0
jhstring rho_cast_helper<jhstring, char const *>::operator()(JNIEnv *env, char const *s)
{
    return jhstring(env->NewStringUTF(s));
}