Bindings updates
[ldk-java] / src / main / java / org / ldk / structs / RouteHop.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 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class RouteHop extends CommonBase {
10         RouteHop(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.RouteHop_free(ptr); }
15         }
16
17         public RouteHop clone() {
18                 long ret = bindings.RouteHop_clone(this.ptr);
19                 RouteHop ret_hu_conv = new RouteHop(null, ret);
20                 ret_hu_conv.ptrs_to.add(this);
21                 return ret_hu_conv;
22         }
23
24         public byte[] get_pubkey() {
25                 byte[] ret = bindings.RouteHop_get_pubkey(this.ptr);
26                 return ret;
27         }
28
29         public void set_pubkey(byte[] val) {
30                 bindings.RouteHop_set_pubkey(this.ptr, val);
31         }
32
33         public NodeFeatures get_node_features() {
34                 long ret = bindings.RouteHop_get_node_features(this.ptr);
35                 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
36                 ret_hu_conv.ptrs_to.add(this);
37                 return ret_hu_conv;
38         }
39
40         public void set_node_features(NodeFeatures val) {
41                 bindings.RouteHop_set_node_features(this.ptr, val == null ? 0 : val.ptr & ~1);
42                 this.ptrs_to.add(val);
43                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
44                 // an object to pass exclusive ownership to the function being called.
45                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
46                 // at the FFI layer, creating a new object which Rust can claim ownership of
47                 // However, in some cases (eg here), there is no way to clone an object, and thus
48                 // we actually have to pass full ownership to Rust.
49                 // Thus, after this call, val is reset to null and is now a dummy object.
50                 val.ptr = 0;
51         }
52
53         public long get_short_channel_id() {
54                 long ret = bindings.RouteHop_get_short_channel_id(this.ptr);
55                 return ret;
56         }
57
58         public void set_short_channel_id(long val) {
59                 bindings.RouteHop_set_short_channel_id(this.ptr, val);
60         }
61
62         public ChannelFeatures get_channel_features() {
63                 long ret = bindings.RouteHop_get_channel_features(this.ptr);
64                 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
65                 ret_hu_conv.ptrs_to.add(this);
66                 return ret_hu_conv;
67         }
68
69         public void set_channel_features(ChannelFeatures val) {
70                 bindings.RouteHop_set_channel_features(this.ptr, val == null ? 0 : val.ptr & ~1);
71                 this.ptrs_to.add(val);
72                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
73                 // an object to pass exclusive ownership to the function being called.
74                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
75                 // at the FFI layer, creating a new object which Rust can claim ownership of
76                 // However, in some cases (eg here), there is no way to clone an object, and thus
77                 // we actually have to pass full ownership to Rust.
78                 // Thus, after this call, val is reset to null and is now a dummy object.
79                 val.ptr = 0;
80         }
81
82         public long get_fee_msat() {
83                 long ret = bindings.RouteHop_get_fee_msat(this.ptr);
84                 return ret;
85         }
86
87         public void set_fee_msat(long val) {
88                 bindings.RouteHop_set_fee_msat(this.ptr, val);
89         }
90
91         public int get_cltv_expiry_delta() {
92                 int ret = bindings.RouteHop_get_cltv_expiry_delta(this.ptr);
93                 return ret;
94         }
95
96         public void set_cltv_expiry_delta(int val) {
97                 bindings.RouteHop_set_cltv_expiry_delta(this.ptr, val);
98         }
99
100         public static RouteHop constructor_new(byte[] pubkey_arg, NodeFeatures node_features_arg, long short_channel_id_arg, ChannelFeatures channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg) {
101                 long ret = bindings.RouteHop_new(pubkey_arg, node_features_arg == null ? 0 : node_features_arg.ptr & ~1, short_channel_id_arg, channel_features_arg == null ? 0 : channel_features_arg.ptr & ~1, fee_msat_arg, cltv_expiry_delta_arg);
102                 RouteHop ret_hu_conv = new RouteHop(null, ret);
103                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
104                 ret_hu_conv.ptrs_to.add(node_features_arg);
105                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
106                 // an object to pass exclusive ownership to the function being called.
107                 // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object
108                 // at the FFI layer, creating a new object which Rust can claim ownership of
109                 // However, in some cases (eg here), there is no way to clone an object, and thus
110                 // we actually have to pass full ownership to Rust.
111                 // Thus, after ret_hu_conv call, node_features_arg is reset to null and is now a dummy object.
112                 node_features_arg.ptr = 0;
113                 ret_hu_conv.ptrs_to.add(channel_features_arg);
114                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
115                 // an object to pass exclusive ownership to the function being called.
116                 // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object
117                 // at the FFI layer, creating a new object which Rust can claim ownership of
118                 // However, in some cases (eg here), there is no way to clone an object, and thus
119                 // we actually have to pass full ownership to Rust.
120                 // Thus, after ret_hu_conv call, channel_features_arg is reset to null and is now a dummy object.
121                 channel_features_arg.ptr = 0;
122                 return ret_hu_conv;
123         }
124
125 }