Bindings updates
[ldk-java] / src / main / java / org / ldk / structs / NodeAnnouncementInfo.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 NodeAnnouncementInfo extends CommonBase {
10         NodeAnnouncementInfo(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.NodeAnnouncementInfo_free(ptr); }
15         }
16
17         public NodeAnnouncementInfo clone() {
18                 long ret = bindings.NodeAnnouncementInfo_clone(this.ptr);
19                 NodeAnnouncementInfo ret_hu_conv = new NodeAnnouncementInfo(null, ret);
20                 ret_hu_conv.ptrs_to.add(this);
21                 return ret_hu_conv;
22         }
23
24         public NodeFeatures get_features() {
25                 long ret = bindings.NodeAnnouncementInfo_get_features(this.ptr);
26                 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
27                 ret_hu_conv.ptrs_to.add(this);
28                 return ret_hu_conv;
29         }
30
31         public void set_features(NodeFeatures val) {
32                 bindings.NodeAnnouncementInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
33                 this.ptrs_to.add(val);
34                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
35                 // an object to pass exclusive ownership to the function being called.
36                 // In most cases, we avoid this being visible in GC'd languages by cloning the object
37                 // at the FFI layer, creating a new object which Rust can claim ownership of
38                 // However, in some cases (eg here), there is no way to clone an object, and thus
39                 // we actually have to pass full ownership to Rust.
40                 // Thus, after this call, val is reset to null and is now a dummy object.
41                 val.ptr = 0;
42         }
43
44         public int get_last_update() {
45                 int ret = bindings.NodeAnnouncementInfo_get_last_update(this.ptr);
46                 return ret;
47         }
48
49         public void set_last_update(int val) {
50                 bindings.NodeAnnouncementInfo_set_last_update(this.ptr, val);
51         }
52
53         public byte[] get_rgb() {
54                 byte[] ret = bindings.NodeAnnouncementInfo_get_rgb(this.ptr);
55                 return ret;
56         }
57
58         public void set_rgb(byte[] val) {
59                 bindings.NodeAnnouncementInfo_set_rgb(this.ptr, val);
60         }
61
62         public byte[] get_alias() {
63                 byte[] ret = bindings.NodeAnnouncementInfo_get_alias(this.ptr);
64                 return ret;
65         }
66
67         public void set_alias(byte[] val) {
68                 bindings.NodeAnnouncementInfo_set_alias(this.ptr, val);
69         }
70
71         public void set_addresses(NetAddress[] val) {
72                 bindings.NodeAnnouncementInfo_set_addresses(this.ptr, Arrays.stream(val).mapToLong(arr_conv_12 -> arr_conv_12.ptr).toArray());
73                 /* TODO 2 NetAddress  */;
74         }
75
76         public NodeAnnouncement get_announcement_message() {
77                 long ret = bindings.NodeAnnouncementInfo_get_announcement_message(this.ptr);
78                 NodeAnnouncement ret_hu_conv = new NodeAnnouncement(null, ret);
79                 ret_hu_conv.ptrs_to.add(this);
80                 return ret_hu_conv;
81         }
82
83         public void set_announcement_message(NodeAnnouncement val) {
84                 bindings.NodeAnnouncementInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1);
85                 this.ptrs_to.add(val);
86         }
87
88         public static NodeAnnouncementInfo constructor_new(NodeFeatures features_arg, int last_update_arg, byte[] rgb_arg, byte[] alias_arg, NetAddress[] addresses_arg, NodeAnnouncement announcement_message_arg) {
89                 long ret = bindings.NodeAnnouncementInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, last_update_arg, rgb_arg, alias_arg, Arrays.stream(addresses_arg).mapToLong(arr_conv_12 -> arr_conv_12.ptr).toArray(), announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1);
90                 NodeAnnouncementInfo ret_hu_conv = new NodeAnnouncementInfo(null, ret);
91                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
92                 ret_hu_conv.ptrs_to.add(features_arg);
93                 // Due to rust's strict-ownership memory model, in some cases we need to "move"
94                 // an object to pass exclusive ownership to the function being called.
95                 // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object
96                 // at the FFI layer, creating a new object which Rust can claim ownership of
97                 // However, in some cases (eg here), there is no way to clone an object, and thus
98                 // we actually have to pass full ownership to Rust.
99                 // Thus, after ret_hu_conv call, features_arg is reset to null and is now a dummy object.
100                 features_arg.ptr = 0;
101                 /* TODO 2 NetAddress  */;
102                 ret_hu_conv.ptrs_to.add(announcement_message_arg);
103                 return ret_hu_conv;
104         }
105
106         public byte[] write() {
107                 byte[] ret = bindings.NodeAnnouncementInfo_write(this.ptr);
108                 return ret;
109         }
110
111         public static Result_NodeAnnouncementInfoDecodeErrorZ constructor_read(byte[] ser) {
112                 long ret = bindings.NodeAnnouncementInfo_read(ser);
113                 Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret);
114                 return ret_hu_conv;
115         }
116
117 }