[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / TxComplete.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_complete message signalling the conclusion of a peer's transaction contributions during
13  * interactive transaction construction.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class TxComplete extends CommonBase {
17         TxComplete(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.TxComplete_free(ptr); }
22         }
23
24         /**
25          * The channel ID
26          */
27         public byte[] get_channel_id() {
28                 byte[] ret = bindings.TxComplete_get_channel_id(this.ptr);
29                 Reference.reachabilityFence(this);
30                 return ret;
31         }
32
33         /**
34          * The channel ID
35          */
36         public void set_channel_id(byte[] val) {
37                 bindings.TxComplete_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
38                 Reference.reachabilityFence(this);
39                 Reference.reachabilityFence(val);
40         }
41
42         /**
43          * Constructs a new TxComplete given each field
44          */
45         public static TxComplete of(byte[] channel_id_arg) {
46                 long ret = bindings.TxComplete_new(InternalUtils.check_arr_len(channel_id_arg, 32));
47                 Reference.reachabilityFence(channel_id_arg);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 org.ldk.structs.TxComplete ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxComplete(null, ret); }
50                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
51                 return ret_hu_conv;
52         }
53
54         long clone_ptr() {
55                 long ret = bindings.TxComplete_clone_ptr(this.ptr);
56                 Reference.reachabilityFence(this);
57                 return ret;
58         }
59
60         /**
61          * Creates a copy of the TxComplete
62          */
63         public TxComplete clone() {
64                 long ret = bindings.TxComplete_clone(this.ptr);
65                 Reference.reachabilityFence(this);
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 org.ldk.structs.TxComplete ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxComplete(null, ret); }
68                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
69                 return ret_hu_conv;
70         }
71
72         /**
73          * Generates a non-cryptographic 64-bit hash of the TxComplete.
74          */
75         public long hash() {
76                 long ret = bindings.TxComplete_hash(this.ptr);
77                 Reference.reachabilityFence(this);
78                 return ret;
79         }
80
81         @Override public int hashCode() {
82                 return (int)this.hash();
83         }
84         /**
85          * Checks if two TxCompletes contain equal inner contents.
86          * This ignores pointers and is_owned flags and looks at the values in fields.
87          * Two objects with NULL inner values will be considered "equal" here.
88          */
89         public boolean eq(org.ldk.structs.TxComplete b) {
90                 boolean ret = bindings.TxComplete_eq(this.ptr, b == null ? 0 : b.ptr);
91                 Reference.reachabilityFence(this);
92                 Reference.reachabilityFence(b);
93                 if (this != null) { this.ptrs_to.add(b); };
94                 return ret;
95         }
96
97         @Override public boolean equals(Object o) {
98                 if (!(o instanceof TxComplete)) return false;
99                 return this.eq((TxComplete)o);
100         }
101         /**
102          * Serialize the TxComplete object into a byte array which can be read by TxComplete_read
103          */
104         public byte[] write() {
105                 byte[] ret = bindings.TxComplete_write(this.ptr);
106                 Reference.reachabilityFence(this);
107                 return ret;
108         }
109
110         /**
111          * Read a TxComplete from a byte array, created by TxComplete_write
112          */
113         public static Result_TxCompleteDecodeErrorZ read(byte[] ser) {
114                 long ret = bindings.TxComplete_read(ser);
115                 Reference.reachabilityFence(ser);
116                 if (ret >= 0 && ret <= 4096) { return null; }
117                 Result_TxCompleteDecodeErrorZ ret_hu_conv = Result_TxCompleteDecodeErrorZ.constr_from_ptr(ret);
118                 return ret_hu_conv;
119         }
120
121 }