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