[Java] Update auto-generated Java bindings for 0.0.113
[ldk-java] / src / main / java / org / ldk / structs / RevokeAndACK.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 revoke_and_ack message to be sent or received from a peer
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class RevokeAndACK extends CommonBase {
16         RevokeAndACK(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.RevokeAndACK_free(ptr); }
21         }
22
23         /**
24          * The channel ID
25          */
26         public byte[] get_channel_id() {
27                 byte[] ret = bindings.RevokeAndACK_get_channel_id(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * The channel ID
34          */
35         public void set_channel_id(byte[] val) {
36                 bindings.RevokeAndACK_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * The secret corresponding to the per-commitment point
43          */
44         public byte[] get_per_commitment_secret() {
45                 byte[] ret = bindings.RevokeAndACK_get_per_commitment_secret(this.ptr);
46                 Reference.reachabilityFence(this);
47                 return ret;
48         }
49
50         /**
51          * The secret corresponding to the per-commitment point
52          */
53         public void set_per_commitment_secret(byte[] val) {
54                 bindings.RevokeAndACK_set_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32));
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(val);
57         }
58
59         /**
60          * The next sender-broadcast commitment transaction's per-commitment point
61          */
62         public byte[] get_next_per_commitment_point() {
63                 byte[] ret = bindings.RevokeAndACK_get_next_per_commitment_point(this.ptr);
64                 Reference.reachabilityFence(this);
65                 return ret;
66         }
67
68         /**
69          * The next sender-broadcast commitment transaction's per-commitment point
70          */
71         public void set_next_per_commitment_point(byte[] val) {
72                 bindings.RevokeAndACK_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
73                 Reference.reachabilityFence(this);
74                 Reference.reachabilityFence(val);
75         }
76
77         /**
78          * Constructs a new RevokeAndACK given each field
79          */
80         public static RevokeAndACK of(byte[] channel_id_arg, byte[] per_commitment_secret_arg, byte[] next_per_commitment_point_arg) {
81                 long ret = bindings.RevokeAndACK_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(per_commitment_secret_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33));
82                 Reference.reachabilityFence(channel_id_arg);
83                 Reference.reachabilityFence(per_commitment_secret_arg);
84                 Reference.reachabilityFence(next_per_commitment_point_arg);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 org.ldk.structs.RevokeAndACK ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevokeAndACK(null, ret); }
87                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
88                 return ret_hu_conv;
89         }
90
91         long clone_ptr() {
92                 long ret = bindings.RevokeAndACK_clone_ptr(this.ptr);
93                 Reference.reachabilityFence(this);
94                 return ret;
95         }
96
97         /**
98          * Creates a copy of the RevokeAndACK
99          */
100         public RevokeAndACK clone() {
101                 long ret = bindings.RevokeAndACK_clone(this.ptr);
102                 Reference.reachabilityFence(this);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 org.ldk.structs.RevokeAndACK ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevokeAndACK(null, ret); }
105                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
106                 return ret_hu_conv;
107         }
108
109         /**
110          * Checks if two RevokeAndACKs contain equal inner contents.
111          * This ignores pointers and is_owned flags and looks at the values in fields.
112          * Two objects with NULL inner values will be considered "equal" here.
113          */
114         public boolean eq(org.ldk.structs.RevokeAndACK b) {
115                 boolean ret = bindings.RevokeAndACK_eq(this.ptr, b == null ? 0 : b.ptr);
116                 Reference.reachabilityFence(this);
117                 Reference.reachabilityFence(b);
118                 if (this != null) { this.ptrs_to.add(b); };
119                 return ret;
120         }
121
122         @Override public boolean equals(Object o) {
123                 if (!(o instanceof RevokeAndACK)) return false;
124                 return this.eq((RevokeAndACK)o);
125         }
126         /**
127          * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
128          */
129         public byte[] write() {
130                 byte[] ret = bindings.RevokeAndACK_write(this.ptr);
131                 Reference.reachabilityFence(this);
132                 return ret;
133         }
134
135         /**
136          * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
137          */
138         public static Result_RevokeAndACKDecodeErrorZ read(byte[] ser) {
139                 long ret = bindings.RevokeAndACK_read(ser);
140                 Reference.reachabilityFence(ser);
141                 if (ret >= 0 && ret <= 4096) { return null; }
142                 Result_RevokeAndACKDecodeErrorZ ret_hu_conv = Result_RevokeAndACKDecodeErrorZ.constr_from_ptr(ret);
143                 return ret_hu_conv;
144         }
145
146 }