]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java
[Java] Update auto-generated Java bindings for 0.0.113
[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 java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * The unsigned part of a node_announcement
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class UnsignedNodeAnnouncement extends CommonBase {
16         UnsignedNodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.UnsignedNodeAnnouncement_free(ptr); }
21         }
22
23         /**
24          * The advertised features
25          */
26         public NodeFeatures get_features() {
27                 long ret = bindings.UnsignedNodeAnnouncement_get_features(this.ptr);
28                 Reference.reachabilityFence(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The advertised features
37          */
38         public void set_features(org.ldk.structs.NodeFeatures val) {
39                 bindings.UnsignedNodeAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr);
40                 Reference.reachabilityFence(this);
41                 Reference.reachabilityFence(val);
42                 if (this != null) { this.ptrs_to.add(val); };
43         }
44
45         /**
46          * A strictly monotonic announcement counter, with gaps allowed
47          */
48         public int get_timestamp() {
49                 int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
50                 Reference.reachabilityFence(this);
51                 return ret;
52         }
53
54         /**
55          * A strictly monotonic announcement counter, with gaps allowed
56          */
57         public void set_timestamp(int val) {
58                 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
59                 Reference.reachabilityFence(this);
60                 Reference.reachabilityFence(val);
61         }
62
63         /**
64          * The node_id this announcement originated from (don't rebroadcast the node_announcement back
65          * to this node).
66          */
67         public byte[] get_node_id() {
68                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
69                 Reference.reachabilityFence(this);
70                 return ret;
71         }
72
73         /**
74          * The node_id this announcement originated from (don't rebroadcast the node_announcement back
75          * to this node).
76          */
77         public void set_node_id(byte[] val) {
78                 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, InternalUtils.check_arr_len(val, 33));
79                 Reference.reachabilityFence(this);
80                 Reference.reachabilityFence(val);
81         }
82
83         /**
84          * An RGB color for UI purposes
85          */
86         public byte[] get_rgb() {
87                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         /**
93          * An RGB color for UI purposes
94          */
95         public void set_rgb(byte[] val) {
96                 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, InternalUtils.check_arr_len(val, 3));
97                 Reference.reachabilityFence(this);
98                 Reference.reachabilityFence(val);
99         }
100
101         /**
102          * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
103          * of uniqueness.
104          */
105         public byte[] get_alias() {
106                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
107                 Reference.reachabilityFence(this);
108                 return ret;
109         }
110
111         /**
112          * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
113          * of uniqueness.
114          */
115         public void set_alias(byte[] val) {
116                 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, InternalUtils.check_arr_len(val, 32));
117                 Reference.reachabilityFence(this);
118                 Reference.reachabilityFence(val);
119         }
120
121         /**
122          * List of addresses on which this node is reachable
123          * 
124          * Returns a copy of the field.
125          */
126         public NetAddress[] get_addresses() {
127                 long[] ret = bindings.UnsignedNodeAnnouncement_get_addresses(this.ptr);
128                 Reference.reachabilityFence(this);
129                 int ret_conv_12_len = ret.length;
130                 NetAddress[] ret_conv_12_arr = new NetAddress[ret_conv_12_len];
131                 for (int m = 0; m < ret_conv_12_len; m++) {
132                         long ret_conv_12 = ret[m];
133                         org.ldk.structs.NetAddress ret_conv_12_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret_conv_12);
134                         if (ret_conv_12_hu_conv != null) { ret_conv_12_hu_conv.ptrs_to.add(this); };
135                         ret_conv_12_arr[m] = ret_conv_12_hu_conv;
136                 }
137                 return ret_conv_12_arr;
138         }
139
140         /**
141          * List of addresses on which this node is reachable
142          */
143         public void set_addresses(NetAddress[] val) {
144                 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null);
145                 Reference.reachabilityFence(this);
146                 Reference.reachabilityFence(val);
147         }
148
149         long clone_ptr() {
150                 long ret = bindings.UnsignedNodeAnnouncement_clone_ptr(this.ptr);
151                 Reference.reachabilityFence(this);
152                 return ret;
153         }
154
155         /**
156          * Creates a copy of the UnsignedNodeAnnouncement
157          */
158         public UnsignedNodeAnnouncement clone() {
159                 long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
160                 Reference.reachabilityFence(this);
161                 if (ret >= 0 && ret <= 4096) { return null; }
162                 org.ldk.structs.UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UnsignedNodeAnnouncement(null, ret); }
163                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
164                 return ret_hu_conv;
165         }
166
167         /**
168          * Checks if two UnsignedNodeAnnouncements contain equal inner contents.
169          * This ignores pointers and is_owned flags and looks at the values in fields.
170          * Two objects with NULL inner values will be considered "equal" here.
171          */
172         public boolean eq(org.ldk.structs.UnsignedNodeAnnouncement b) {
173                 boolean ret = bindings.UnsignedNodeAnnouncement_eq(this.ptr, b == null ? 0 : b.ptr);
174                 Reference.reachabilityFence(this);
175                 Reference.reachabilityFence(b);
176                 if (this != null) { this.ptrs_to.add(b); };
177                 return ret;
178         }
179
180         @Override public boolean equals(Object o) {
181                 if (!(o instanceof UnsignedNodeAnnouncement)) return false;
182                 return this.eq((UnsignedNodeAnnouncement)o);
183         }
184         /**
185          * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
186          */
187         public byte[] write() {
188                 byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
189                 Reference.reachabilityFence(this);
190                 return ret;
191         }
192
193         /**
194          * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
195          */
196         public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) {
197                 long ret = bindings.UnsignedNodeAnnouncement_read(ser);
198                 Reference.reachabilityFence(ser);
199                 if (ret >= 0 && ret <= 4096) { return null; }
200                 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);
201                 return ret_hu_conv;
202         }
203
204 }