Update auto-generated bindings
[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 import javax.annotation.Nullable;
8
9
10 /**
11  * The unsigned part of a node_announcement
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class UnsignedNodeAnnouncement extends CommonBase {
15         UnsignedNodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.UnsignedNodeAnnouncement_free(ptr); }
20         }
21
22         /**
23          * The advertised features
24          */
25         public NodeFeatures get_features() {
26                 long ret = bindings.UnsignedNodeAnnouncement_get_features(this.ptr);
27                 if (ret >= 0 && ret <= 4096) { return null; }
28                 NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); }
29                 ret_hu_conv.ptrs_to.add(this);
30                 return ret_hu_conv;
31         }
32
33         /**
34          * The advertised features
35          */
36         public void set_features(NodeFeatures val) {
37                 bindings.UnsignedNodeAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
38         }
39
40         /**
41          * A strictly monotonic announcement counter, with gaps allowed
42          */
43         public int get_timestamp() {
44                 int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
45                 return ret;
46         }
47
48         /**
49          * A strictly monotonic announcement counter, with gaps allowed
50          */
51         public void set_timestamp(int val) {
52                 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
53         }
54
55         /**
56          * The node_id this announcement originated from (don't rebroadcast the node_announcement back
57          * to this node).
58          */
59         public byte[] get_node_id() {
60                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
61                 return ret;
62         }
63
64         /**
65          * The node_id this announcement originated from (don't rebroadcast the node_announcement back
66          * to this node).
67          */
68         public void set_node_id(byte[] val) {
69                 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, InternalUtils.check_arr_len(val, 33));
70         }
71
72         /**
73          * An RGB color for UI purposes
74          */
75         public byte[] get_rgb() {
76                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
77                 return ret;
78         }
79
80         /**
81          * An RGB color for UI purposes
82          */
83         public void set_rgb(byte[] val) {
84                 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, InternalUtils.check_arr_len(val, 3));
85         }
86
87         /**
88          * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
89          * of uniqueness.
90          */
91         public byte[] get_alias() {
92                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
93                 return ret;
94         }
95
96         /**
97          * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
98          * of uniqueness.
99          */
100         public void set_alias(byte[] val) {
101                 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, InternalUtils.check_arr_len(val, 32));
102         }
103
104         /**
105          * List of addresses on which this node is reachable
106          */
107         public void set_addresses(NetAddress[] val) {
108                 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null);
109         }
110
111         long clone_ptr() {
112                 long ret = bindings.UnsignedNodeAnnouncement_clone_ptr(this.ptr);
113                 return ret;
114         }
115
116         /**
117          * Creates a copy of the UnsignedNodeAnnouncement
118          */
119         public UnsignedNodeAnnouncement clone() {
120                 long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
121                 if (ret >= 0 && ret <= 4096) { return null; }
122                 UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedNodeAnnouncement(null, ret); }
123                 ret_hu_conv.ptrs_to.add(this);
124                 return ret_hu_conv;
125         }
126
127         /**
128          * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
129          */
130         public byte[] write() {
131                 byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
132                 return ret;
133         }
134
135         /**
136          * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
137          */
138         public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) {
139                 long ret = bindings.UnsignedNodeAnnouncement_read(ser);
140                 if (ret >= 0 && ret <= 4096) { return null; }
141                 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);
142                 return ret_hu_conv;
143         }
144
145 }