Bindings updates
[ldk-java] / src / main / java / org / ldk / structs / UnsignedNodeAnnouncement.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 UnsignedNodeAnnouncement extends CommonBase {
10         UnsignedNodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.UnsignedNodeAnnouncement_free(ptr); }
15         }
16
17         public UnsignedNodeAnnouncement clone() {
18                 long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
19                 UnsignedNodeAnnouncement ret_hu_conv = new UnsignedNodeAnnouncement(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.UnsignedNodeAnnouncement_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.UnsignedNodeAnnouncement_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_timestamp() {
45                 int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
46                 return ret;
47         }
48
49         public void set_timestamp(int val) {
50                 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
51         }
52
53         public byte[] get_node_id() {
54                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
55                 return ret;
56         }
57
58         public void set_node_id(byte[] val) {
59                 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val);
60         }
61
62         public byte[] get_rgb() {
63                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
64                 return ret;
65         }
66
67         public void set_rgb(byte[] val) {
68                 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, val);
69         }
70
71         public byte[] get_alias() {
72                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
73                 return ret;
74         }
75
76         public void set_alias(byte[] val) {
77                 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, val);
78         }
79
80         public void set_addresses(NetAddress[] val) {
81                 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, Arrays.stream(val).mapToLong(arr_conv_12 -> arr_conv_12.ptr).toArray());
82                 /* TODO 2 NetAddress  */;
83         }
84
85         public byte[] write() {
86                 byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
87                 return ret;
88         }
89
90         public static Result_UnsignedNodeAnnouncementDecodeErrorZ constructor_read(byte[] ser) {
91                 long ret = bindings.UnsignedNodeAnnouncement_read(ser);
92                 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);
93                 return ret_hu_conv;
94         }
95
96 }