Update auto-generated bindings to latest upstream
[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 < 1024) { return null; }
28                 NodeFeatures 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                 this.ptrs_to.add(val);
39         }
40
41         /**
42          * A strictly monotonic announcement counter, with gaps allowed
43          */
44         public int get_timestamp() {
45                 int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr);
46                 return ret;
47         }
48
49         /**
50          * A strictly monotonic announcement counter, with gaps allowed
51          */
52         public void set_timestamp(int val) {
53                 bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val);
54         }
55
56         /**
57          * The node_id this announcement originated from (don't rebroadcast the node_announcement back
58          * to this node).
59          */
60         public byte[] get_node_id() {
61                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr);
62                 return ret;
63         }
64
65         /**
66          * The node_id this announcement originated from (don't rebroadcast the node_announcement back
67          * to this node).
68          */
69         public void set_node_id(byte[] val) {
70                 bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, val);
71         }
72
73         /**
74          * An RGB color for UI purposes
75          */
76         public byte[] get_rgb() {
77                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr);
78                 return ret;
79         }
80
81         /**
82          * An RGB color for UI purposes
83          */
84         public void set_rgb(byte[] val) {
85                 bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, val);
86         }
87
88         /**
89          * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
90          * of uniqueness.
91          */
92         public byte[] get_alias() {
93                 byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr);
94                 return ret;
95         }
96
97         /**
98          * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
99          * of uniqueness.
100          */
101         public void set_alias(byte[] val) {
102                 bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, val);
103         }
104
105         /**
106          * List of addresses on which this node is reachable
107          */
108         public void set_addresses(NetAddress[] val) {
109                 bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null);
110                 /* TODO 2 NetAddress  */;
111         }
112
113         /**
114          * Creates a copy of the UnsignedNodeAnnouncement
115          */
116         public UnsignedNodeAnnouncement clone() {
117                 long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr);
118                 if (ret < 1024) { return null; }
119                 UnsignedNodeAnnouncement ret_hu_conv = new UnsignedNodeAnnouncement(null, ret);
120                 ret_hu_conv.ptrs_to.add(this);
121                 return ret_hu_conv;
122         }
123
124         /**
125          * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
126          */
127         public byte[] write() {
128                 byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr);
129                 return ret;
130         }
131
132         /**
133          * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
134          */
135         public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) {
136                 long ret = bindings.UnsignedNodeAnnouncement_read(ser);
137                 if (ret < 1024) { return null; }
138                 Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret);
139                 return ret_hu_conv;
140         }
141
142 }