blob: 48688382f1d7b8a9c7a6fe113b85ed5f15f9305c [file]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// DO NOT EDIT IT MANUALLY. This file is generated by opendal/dev/src/generate/java.rs.
use crate::Result;
use crate::convert;
use jni::Env;
use jni::jni_sig;
use jni::jni_str;
use jni::objects::JObject;
use jni::objects::JValue;
use opendal::Capability;
pub(crate) fn make_capability<'a>(env: &mut Env<'a>, cap: Capability) -> Result<JObject<'a>> {
let capability = env.new_object(
jni_str!("org/apache/opendal/Capability"),
jni_sig!(
"({{ jni_sig }})V"
),
&[
{%- for f in fields %}
{%- if f.is_bool %}
JValue::Bool(cap.{{ f.name }}),
{%- else %}
JValue::Long(convert::usize_to_jlong(cap.{{ f.name }})),
{%- endif %}
{%- endfor %}
],
)?;
Ok(capability)
}