[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / SpliceLocked.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 splice_locked message to be sent to or received from a peer.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class SpliceLocked extends CommonBase {
16         SpliceLocked(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.SpliceLocked_free(ptr); }
21         }
22
23         /**
24          * The channel ID
25          */
26         public byte[] get_channel_id() {
27                 byte[] ret = bindings.SpliceLocked_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.SpliceLocked_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * Constructs a new SpliceLocked given each field
43          */
44         public static SpliceLocked of(byte[] channel_id_arg) {
45                 long ret = bindings.SpliceLocked_new(InternalUtils.check_arr_len(channel_id_arg, 32));
46                 Reference.reachabilityFence(channel_id_arg);
47                 if (ret >= 0 && ret <= 4096) { return null; }
48                 org.ldk.structs.SpliceLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceLocked(null, ret); }
49                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
50                 return ret_hu_conv;
51         }
52
53         long clone_ptr() {
54                 long ret = bindings.SpliceLocked_clone_ptr(this.ptr);
55                 Reference.reachabilityFence(this);
56                 return ret;
57         }
58
59         /**
60          * Creates a copy of the SpliceLocked
61          */
62         public SpliceLocked clone() {
63                 long ret = bindings.SpliceLocked_clone(this.ptr);
64                 Reference.reachabilityFence(this);
65                 if (ret >= 0 && ret <= 4096) { return null; }
66                 org.ldk.structs.SpliceLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceLocked(null, ret); }
67                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
68                 return ret_hu_conv;
69         }
70
71         /**
72          * Checks if two SpliceLockeds contain equal inner contents.
73          * This ignores pointers and is_owned flags and looks at the values in fields.
74          * Two objects with NULL inner values will be considered "equal" here.
75          */
76         public boolean eq(org.ldk.structs.SpliceLocked b) {
77                 boolean ret = bindings.SpliceLocked_eq(this.ptr, b == null ? 0 : b.ptr);
78                 Reference.reachabilityFence(this);
79                 Reference.reachabilityFence(b);
80                 if (this != null) { this.ptrs_to.add(b); };
81                 return ret;
82         }
83
84         @Override public boolean equals(Object o) {
85                 if (!(o instanceof SpliceLocked)) return false;
86                 return this.eq((SpliceLocked)o);
87         }
88         /**
89          * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read
90          */
91         public byte[] write() {
92                 byte[] ret = bindings.SpliceLocked_write(this.ptr);
93                 Reference.reachabilityFence(this);
94                 return ret;
95         }
96
97         /**
98          * Read a SpliceLocked from a byte array, created by SpliceLocked_write
99          */
100         public static Result_SpliceLockedDecodeErrorZ read(byte[] ser) {
101                 long ret = bindings.SpliceLocked_read(ser);
102                 Reference.reachabilityFence(ser);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 Result_SpliceLockedDecodeErrorZ ret_hu_conv = Result_SpliceLockedDecodeErrorZ.constr_from_ptr(ret);
105                 return ret_hu_conv;
106         }
107
108 }