[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / TxAbort.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 tx_abort message which signals the cancellation of an in-progress transaction negotiation.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class TxAbort extends CommonBase {
16         TxAbort(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.TxAbort_free(ptr); }
21         }
22
23         /**
24          * The channel ID
25          */
26         public byte[] get_channel_id() {
27                 byte[] ret = bindings.TxAbort_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.TxAbort_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * Message data
43          * 
44          * Returns a copy of the field.
45          */
46         public byte[] get_data() {
47                 byte[] ret = bindings.TxAbort_get_data(this.ptr);
48                 Reference.reachabilityFence(this);
49                 return ret;
50         }
51
52         /**
53          * Message data
54          */
55         public void set_data(byte[] val) {
56                 bindings.TxAbort_set_data(this.ptr, val);
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         /**
62          * Constructs a new TxAbort given each field
63          */
64         public static TxAbort of(byte[] channel_id_arg, byte[] data_arg) {
65                 long ret = bindings.TxAbort_new(InternalUtils.check_arr_len(channel_id_arg, 32), data_arg);
66                 Reference.reachabilityFence(channel_id_arg);
67                 Reference.reachabilityFence(data_arg);
68                 if (ret >= 0 && ret <= 4096) { return null; }
69                 org.ldk.structs.TxAbort ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAbort(null, ret); }
70                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
71                 return ret_hu_conv;
72         }
73
74         long clone_ptr() {
75                 long ret = bindings.TxAbort_clone_ptr(this.ptr);
76                 Reference.reachabilityFence(this);
77                 return ret;
78         }
79
80         /**
81          * Creates a copy of the TxAbort
82          */
83         public TxAbort clone() {
84                 long ret = bindings.TxAbort_clone(this.ptr);
85                 Reference.reachabilityFence(this);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 org.ldk.structs.TxAbort ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAbort(null, ret); }
88                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
89                 return ret_hu_conv;
90         }
91
92         /**
93          * Generates a non-cryptographic 64-bit hash of the TxAbort.
94          */
95         public long hash() {
96                 long ret = bindings.TxAbort_hash(this.ptr);
97                 Reference.reachabilityFence(this);
98                 return ret;
99         }
100
101         @Override public int hashCode() {
102                 return (int)this.hash();
103         }
104         /**
105          * Checks if two TxAborts contain equal inner contents.
106          * This ignores pointers and is_owned flags and looks at the values in fields.
107          * Two objects with NULL inner values will be considered "equal" here.
108          */
109         public boolean eq(org.ldk.structs.TxAbort b) {
110                 boolean ret = bindings.TxAbort_eq(this.ptr, b == null ? 0 : b.ptr);
111                 Reference.reachabilityFence(this);
112                 Reference.reachabilityFence(b);
113                 if (this != null) { this.ptrs_to.add(b); };
114                 return ret;
115         }
116
117         @Override public boolean equals(Object o) {
118                 if (!(o instanceof TxAbort)) return false;
119                 return this.eq((TxAbort)o);
120         }
121         /**
122          * Serialize the TxAbort object into a byte array which can be read by TxAbort_read
123          */
124         public byte[] write() {
125                 byte[] ret = bindings.TxAbort_write(this.ptr);
126                 Reference.reachabilityFence(this);
127                 return ret;
128         }
129
130         /**
131          * Read a TxAbort from a byte array, created by TxAbort_write
132          */
133         public static Result_TxAbortDecodeErrorZ read(byte[] ser) {
134                 long ret = bindings.TxAbort_read(ser);
135                 Reference.reachabilityFence(ser);
136                 if (ret >= 0 && ret <= 4096) { return null; }
137                 Result_TxAbortDecodeErrorZ ret_hu_conv = Result_TxAbortDecodeErrorZ.constr_from_ptr(ret);
138                 return ret_hu_conv;
139         }
140
141 }