[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / QueryShortChannelIds.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  * A [`query_short_channel_ids`] message is used to query a peer for
13  * routing gossip messages related to one or more `short_channel_id`s.
14  * 
15  * The query recipient will reply with the latest, if available,
16  * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages
17  * it maintains for the requested `short_channel_id`s followed by a
18  * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in
19  * this query are encoded. We only support `encoding_type=0` uncompressed
20  * serialization and do not support `encoding_type=1` zlib serialization.
21  * 
22  * [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages
23  */
24 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
25 public class QueryShortChannelIds extends CommonBase {
26         QueryShortChannelIds(Object _dummy, long ptr) { super(ptr); }
27         @Override @SuppressWarnings("deprecation")
28         protected void finalize() throws Throwable {
29                 super.finalize();
30                 if (ptr != 0) { bindings.QueryShortChannelIds_free(ptr); }
31         }
32
33         /**
34          * The genesis hash of the blockchain being queried
35          */
36         public byte[] get_chain_hash() {
37                 byte[] ret = bindings.QueryShortChannelIds_get_chain_hash(this.ptr);
38                 Reference.reachabilityFence(this);
39                 return ret;
40         }
41
42         /**
43          * The genesis hash of the blockchain being queried
44          */
45         public void set_chain_hash(byte[] val) {
46                 bindings.QueryShortChannelIds_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
47                 Reference.reachabilityFence(this);
48                 Reference.reachabilityFence(val);
49         }
50
51         /**
52          * The short_channel_ids that are being queried
53          * 
54          * Returns a copy of the field.
55          */
56         public long[] get_short_channel_ids() {
57                 long[] ret = bindings.QueryShortChannelIds_get_short_channel_ids(this.ptr);
58                 Reference.reachabilityFence(this);
59                 return ret;
60         }
61
62         /**
63          * The short_channel_ids that are being queried
64          */
65         public void set_short_channel_ids(long[] val) {
66                 bindings.QueryShortChannelIds_set_short_channel_ids(this.ptr, val);
67                 Reference.reachabilityFence(this);
68                 Reference.reachabilityFence(val);
69         }
70
71         /**
72          * Constructs a new QueryShortChannelIds given each field
73          */
74         public static QueryShortChannelIds of(byte[] chain_hash_arg, long[] short_channel_ids_arg) {
75                 long ret = bindings.QueryShortChannelIds_new(InternalUtils.check_arr_len(chain_hash_arg, 32), short_channel_ids_arg);
76                 Reference.reachabilityFence(chain_hash_arg);
77                 Reference.reachabilityFence(short_channel_ids_arg);
78                 if (ret >= 0 && ret <= 4096) { return null; }
79                 org.ldk.structs.QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, ret); }
80                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
81                 return ret_hu_conv;
82         }
83
84         long clone_ptr() {
85                 long ret = bindings.QueryShortChannelIds_clone_ptr(this.ptr);
86                 Reference.reachabilityFence(this);
87                 return ret;
88         }
89
90         /**
91          * Creates a copy of the QueryShortChannelIds
92          */
93         public QueryShortChannelIds clone() {
94                 long ret = bindings.QueryShortChannelIds_clone(this.ptr);
95                 Reference.reachabilityFence(this);
96                 if (ret >= 0 && ret <= 4096) { return null; }
97                 org.ldk.structs.QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.QueryShortChannelIds(null, ret); }
98                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
99                 return ret_hu_conv;
100         }
101
102         /**
103          * Generates a non-cryptographic 64-bit hash of the QueryShortChannelIds.
104          */
105         public long hash() {
106                 long ret = bindings.QueryShortChannelIds_hash(this.ptr);
107                 Reference.reachabilityFence(this);
108                 return ret;
109         }
110
111         @Override public int hashCode() {
112                 return (int)this.hash();
113         }
114         /**
115          * Checks if two QueryShortChannelIdss contain equal inner contents.
116          * This ignores pointers and is_owned flags and looks at the values in fields.
117          * Two objects with NULL inner values will be considered "equal" here.
118          */
119         public boolean eq(org.ldk.structs.QueryShortChannelIds b) {
120                 boolean ret = bindings.QueryShortChannelIds_eq(this.ptr, b == null ? 0 : b.ptr);
121                 Reference.reachabilityFence(this);
122                 Reference.reachabilityFence(b);
123                 if (this != null) { this.ptrs_to.add(b); };
124                 return ret;
125         }
126
127         @Override public boolean equals(Object o) {
128                 if (!(o instanceof QueryShortChannelIds)) return false;
129                 return this.eq((QueryShortChannelIds)o);
130         }
131         /**
132          * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
133          */
134         public static Result_QueryShortChannelIdsDecodeErrorZ read(byte[] ser) {
135                 long ret = bindings.QueryShortChannelIds_read(ser);
136                 Reference.reachabilityFence(ser);
137                 if (ret >= 0 && ret <= 4096) { return null; }
138                 Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret);
139                 return ret_hu_conv;
140         }
141
142         /**
143          * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
144          */
145         public byte[] write() {
146                 byte[] ret = bindings.QueryShortChannelIds_write(this.ptr);
147                 Reference.reachabilityFence(this);
148                 return ret;
149         }
150
151 }