[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / UpdateFailHTLC.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  * An [`update_fail_htlc`] message to be sent to or received from a peer.
13  * 
14  * [`update_fail_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class UpdateFailHTLC extends CommonBase {
18         UpdateFailHTLC(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.UpdateFailHTLC_free(ptr); }
23         }
24
25         /**
26          * The channel ID
27          */
28         public byte[] get_channel_id() {
29                 byte[] ret = bindings.UpdateFailHTLC_get_channel_id(this.ptr);
30                 Reference.reachabilityFence(this);
31                 return ret;
32         }
33
34         /**
35          * The channel ID
36          */
37         public void set_channel_id(byte[] val) {
38                 bindings.UpdateFailHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
39                 Reference.reachabilityFence(this);
40                 Reference.reachabilityFence(val);
41         }
42
43         /**
44          * The HTLC ID
45          */
46         public long get_htlc_id() {
47                 long ret = bindings.UpdateFailHTLC_get_htlc_id(this.ptr);
48                 Reference.reachabilityFence(this);
49                 return ret;
50         }
51
52         /**
53          * The HTLC ID
54          */
55         public void set_htlc_id(long val) {
56                 bindings.UpdateFailHTLC_set_htlc_id(this.ptr, val);
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         long clone_ptr() {
62                 long ret = bindings.UpdateFailHTLC_clone_ptr(this.ptr);
63                 Reference.reachabilityFence(this);
64                 return ret;
65         }
66
67         /**
68          * Creates a copy of the UpdateFailHTLC
69          */
70         public UpdateFailHTLC clone() {
71                 long ret = bindings.UpdateFailHTLC_clone(this.ptr);
72                 Reference.reachabilityFence(this);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 org.ldk.structs.UpdateFailHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFailHTLC(null, ret); }
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
76                 return ret_hu_conv;
77         }
78
79         /**
80          * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC.
81          */
82         public long hash() {
83                 long ret = bindings.UpdateFailHTLC_hash(this.ptr);
84                 Reference.reachabilityFence(this);
85                 return ret;
86         }
87
88         @Override public int hashCode() {
89                 return (int)this.hash();
90         }
91         /**
92          * Checks if two UpdateFailHTLCs contain equal inner contents.
93          * This ignores pointers and is_owned flags and looks at the values in fields.
94          * Two objects with NULL inner values will be considered "equal" here.
95          */
96         public boolean eq(org.ldk.structs.UpdateFailHTLC b) {
97                 boolean ret = bindings.UpdateFailHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
98                 Reference.reachabilityFence(this);
99                 Reference.reachabilityFence(b);
100                 if (this != null) { this.ptrs_to.add(b); };
101                 return ret;
102         }
103
104         @Override public boolean equals(Object o) {
105                 if (!(o instanceof UpdateFailHTLC)) return false;
106                 return this.eq((UpdateFailHTLC)o);
107         }
108         /**
109          * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
110          */
111         public byte[] write() {
112                 byte[] ret = bindings.UpdateFailHTLC_write(this.ptr);
113                 Reference.reachabilityFence(this);
114                 return ret;
115         }
116
117         /**
118          * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
119          */
120         public static Result_UpdateFailHTLCDecodeErrorZ read(byte[] ser) {
121                 long ret = bindings.UpdateFailHTLC_read(ser);
122                 Reference.reachabilityFence(ser);
123                 if (ret >= 0 && ret <= 4096) { return null; }
124                 Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret);
125                 return ret_hu_conv;
126         }
127
128 }