1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class Access extends CommonBase {
10 final bindings.LDKAccess bindings_instance;
11 Access(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
12 private Access(bindings.LDKAccess arg) {
13 super(bindings.LDKAccess_new(arg));
14 this.ptrs_to.add(arg);
15 this.bindings_instance = arg;
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.Access_free(ptr); } super.finalize();
22 public static interface AccessInterface {
23 Result_TxOutAccessErrorZ get_utxo(byte[] genesis_hash, long short_channel_id);
25 private static class LDKAccessHolder { Access held; }
26 public static Access new_impl(AccessInterface arg) {
27 final LDKAccessHolder impl_holder = new LDKAccessHolder();
28 impl_holder.held = new Access(new bindings.LDKAccess() {
29 @Override public long get_utxo(byte[] genesis_hash, long short_channel_id) {
30 Result_TxOutAccessErrorZ ret = arg.get_utxo(genesis_hash, short_channel_id);
31 long result = ret != null ? ret.ptr : 0;
36 return impl_holder.held;
38 public Result_TxOutAccessErrorZ get_utxo(byte[] genesis_hash, long short_channel_id) {
39 long ret = bindings.Access_get_utxo(this.ptr, genesis_hash, short_channel_id);
40 Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret);
41 ret_hu_conv.ptrs_to.add(this);