Bindings updates
[ldk-java] / src / main / java / org / ldk / structs / ChannelInfo.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 ChannelInfo extends CommonBase {
10         ChannelInfo(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.ChannelInfo_free(ptr); }
15         }
16
17         public ChannelFeatures get_features() {
18                 long ret = bindings.ChannelInfo_get_features(this.ptr);
19                 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
20                 ret_hu_conv.ptrs_to.add(this);
21                 return ret_hu_conv;
22         }
23
24         public void set_features(ChannelFeatures val) {
25                 bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
26                 this.ptrs_to.add(val);
27                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
28                 // an object to pass exclusive ownership to the function being called.
29                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
30                 // at the FFI layer, creating a new object which Rust can claim ownership of
31                 // However, in some cases (eg here), there is no way to clone an object, and thus
32                 // we actually have to pass full ownership to Rust.
33                 // Thus, after this call, val is reset to null and is now a dummy object.
34                 val.ptr = 0;
35         }
36
37         public byte[] get_node_one() {
38                 byte[] ret = bindings.ChannelInfo_get_node_one(this.ptr);
39                 return ret;
40         }
41
42         public void set_node_one(byte[] val) {
43                 bindings.ChannelInfo_set_node_one(this.ptr, val);
44         }
45
46         public DirectionalChannelInfo get_one_to_two() {
47                 long ret = bindings.ChannelInfo_get_one_to_two(this.ptr);
48                 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
49                 ret_hu_conv.ptrs_to.add(this);
50                 return ret_hu_conv;
51         }
52
53         public void set_one_to_two(DirectionalChannelInfo val) {
54                 bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1);
55                 this.ptrs_to.add(val);
56         }
57
58         public byte[] get_node_two() {
59                 byte[] ret = bindings.ChannelInfo_get_node_two(this.ptr);
60                 return ret;
61         }
62
63         public void set_node_two(byte[] val) {
64                 bindings.ChannelInfo_set_node_two(this.ptr, val);
65         }
66
67         public DirectionalChannelInfo get_two_to_one() {
68                 long ret = bindings.ChannelInfo_get_two_to_one(this.ptr);
69                 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
70                 ret_hu_conv.ptrs_to.add(this);
71                 return ret_hu_conv;
72         }
73
74         public void set_two_to_one(DirectionalChannelInfo val) {
75                 bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1);
76                 this.ptrs_to.add(val);
77         }
78
79         public ChannelAnnouncement get_announcement_message() {
80                 long ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
81                 ChannelAnnouncement ret_hu_conv = new ChannelAnnouncement(null, ret);
82                 ret_hu_conv.ptrs_to.add(this);
83                 return ret_hu_conv;
84         }
85
86         public void set_announcement_message(ChannelAnnouncement val) {
87                 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1);
88                 this.ptrs_to.add(val);
89         }
90
91         public byte[] write() {
92                 byte[] ret = bindings.ChannelInfo_write(this.ptr);
93                 return ret;
94         }
95
96         public static ChannelInfo constructor_read(byte[] ser) {
97                 long ret = bindings.ChannelInfo_read(ser);
98                 ChannelInfo ret_hu_conv = new ChannelInfo(null, ret);
99                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
100                 return ret_hu_conv;
101         }
102
103 }