Update java bindings with new generator and new upstream code
[ldk-java] / src / main / java / org / ldk / structs / LockedNetworkGraph.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8
9 /**
10  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
11  * This exists only to make accessing a RwLock<NetworkGraph> possible from
12  * the C bindings, as it can be done directly in Rust code.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class LockedNetworkGraph extends CommonBase implements AutoCloseable {
16         LockedNetworkGraph(Object _dummy, long ptr) { super(ptr); }
17         @Override public void close() {
18                 if (ptr != 0) { bindings.LockedNetworkGraph_free(ptr); }
19         }
20
21         /**
22          * Get a reference to the NetworkGraph which this read-lock contains.
23          */
24         public NetworkGraph graph() {
25                 long ret = bindings.LockedNetworkGraph_graph(this.ptr);
26                 NetworkGraph ret_hu_conv = new NetworkGraph(null, ret);
27                 ret_hu_conv.ptrs_to.add(this);
28                 return ret_hu_conv;
29         }
30
31 }