MCPcopy Create free account
hub / github.com/cedar-policy/cedar-java / of

Method of

CedarJavaFFI/src/objects.rs:183–194  ·  view source on GitHub ↗

Construct an optional containing the Java object `t` (equivalent to [`Option::Some`])

(env: &mut JNIEnv<'a>, t: T)

Source from the content-addressed store, hash-verified

181
182 /// Construct an optional containing the Java object `t` (equivalent to [`Option::Some`])
183 pub fn of(env: &mut JNIEnv<'a>, t: T) -> Result<Self> {
184 let value = env.call_static_method(
185 "java/util/Optional",
186 "of",
187 "(Ljava/lang/Object;)Ljava/util/Optional;",
188 &[JValueGen::Object(t.as_ref())],
189 )?;
190 Ok(Self {
191 value,
192 marker: PhantomData,
193 })
194 }
195
196 /// Move from a Rust [Option] to a Java optional
197 pub fn from_optional(env: &mut JNIEnv<'a>, t: Option<T>) -> Result<Self> {

Callers

nothing calls this directly

Calls 2

ObjectInterface · 0.85
as_refMethod · 0.45

Tested by

no test coverage detected