toad_jni/java/time/
duration.rs1use crate::java;
2
3pub struct Duration(java::lang::Object);
5
6impl Duration {
7 pub fn of_millis(e: &mut java::Env, millis: i64) -> Self {
9 static OF_MILLIS: java::StaticMethod<Duration, fn(i64) -> Duration> =
10 java::StaticMethod::new("ofMillis");
11 OF_MILLIS.invoke(e, millis)
12 }
13
14 pub fn to_millis(&self, e: &mut java::Env) -> i64 {
16 static TO_MILLIS: java::Method<Duration, fn() -> i64> = java::Method::new("toMillis");
17 TO_MILLIS.invoke(e, self)
18 }
19}
20
21impl java::Class for Duration {
22 const PATH: &'static str = "java/time/Duration";
23}
24
25impl java::Object for Duration {
26 fn upcast(_: &mut java::Env, jobj: java::lang::Object) -> Self {
27 Self(jobj)
28 }
29
30 fn downcast(self, _: &mut java::Env) -> java::lang::Object {
31 self.0
32 }
33
34 fn downcast_ref(&self, e: &mut java::Env) -> java::lang::Object {
35 self.0.downcast_ref(e)
36 }
37}