jni-bind

Crates.iojni-bind
lib.rsjni-bind
version0.1.6
sourcesrc
created_at2024-08-02 05:49:28.427678
updated_at2024-08-06 09:57:07.300869
descriptionMade importing classes from java easy
homepage
repositoryhttps://github.com/YC-Lammy/jni-bind-rs
max_upload_size
id1322857
size43,294
YC-L (YC-Lammy)

documentation

https://docs.rs/jni-bind

README

jni-bind-rs

Docs Crates.io Crates.io

Made importing classes from java easy!

This library provides the import_class macro that automatically implements the object structure. All the method IDs and classes are cached to increase performance.

Known Limitations

  • cannot import generic classes and methods.
  • cannot import constants.

Examples

Basic usage of import_class:

#![no_main]

use jni_bind::import_class;
use jni_bind::{jboolean, jint, jlong};

import_class! {
    "java/lang/Object";
    Object;
    constructor();
    /// Indicates whether some other object is "equal to" this one.
    fn equals(&self, other: Object) ->  jboolean;
    /// Returns a hash code value for the object.
    fn hashCode(&self) -> jint;
    /// Wakes up a single thread that is waiting on this object's monitor.
    fn notify(&self) -> ();
    /// Wakes up all threads that are waiting on this object's monitor.
    fn notifyAll(&self) -> ();
    /// Returns a string representation of the object.
    fn toString(&self) -> String;
    /// Causes the current thread to wait until it is awakened,
    /// typically by being notified or interrupted,
    /// or until a certain amount of real time has elapsed.
    fn wait(&self, timeout_millis: jlong, nanos: jint) -> ();
}

import_class!{
    "java/lang/String";
    String;
    extends Object;
}
Commit count: 0

cargo fmt