[Java] Update auto-generated bindings to LDK 0.0.123
[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 ChannelId get_channel_id() {
27                 long ret = bindings.SpliceLocked_get_channel_id(this.ptr);
28                 Reference.reachabilityFence(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The channel ID
37          */
38         public void set_channel_id(org.ldk.structs.ChannelId val) {
39                 bindings.SpliceLocked_set_channel_id(this.ptr, val.ptr);
40                 Reference.reachabilityFence(this);
41                 Reference.reachabilityFence(val);
42                 if (this != null) { this.ptrs_to.add(val); };
43         }
44
45         /**
46          * Constructs a new SpliceLocked given each field
47          */
48         public static SpliceLocked of(org.ldk.structs.ChannelId channel_id_arg) {
49                 long ret = bindings.SpliceLocked_new(channel_id_arg.ptr);
50                 Reference.reachabilityFence(channel_id_arg);
51                 if (ret >= 0 && ret <= 4096) { return null; }
52                 org.ldk.structs.SpliceLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceLocked(null, ret); }
53                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
54                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
55                 return ret_hu_conv;
56         }
57
58         long clone_ptr() {
59                 long ret = bindings.SpliceLocked_clone_ptr(this.ptr);
60                 Reference.reachabilityFence(this);
61                 return ret;
62         }
63
64         /**
65          * Creates a copy of the SpliceLocked
66          */
67         public SpliceLocked clone() {
68                 long ret = bindings.SpliceLocked_clone(this.ptr);
69                 Reference.reachabilityFence(this);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 org.ldk.structs.SpliceLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceLocked(null, ret); }
72                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
73                 return ret_hu_conv;
74         }
75
76         /**
77          * Checks if two SpliceLockeds contain equal inner contents.
78          * This ignores pointers and is_owned flags and looks at the values in fields.
79          * Two objects with NULL inner values will be considered "equal" here.
80          */
81         public boolean eq(org.ldk.structs.SpliceLocked b) {
82                 boolean ret = bindings.SpliceLocked_eq(this.ptr, b.ptr);
83                 Reference.reachabilityFence(this);
84                 Reference.reachabilityFence(b);
85                 if (this != null) { this.ptrs_to.add(b); };
86                 return ret;
87         }
88
89         @Override public boolean equals(Object o) {
90                 if (!(o instanceof SpliceLocked)) return false;
91                 return this.eq((SpliceLocked)o);
92         }
93         /**
94          * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read
95          */
96         public byte[] write() {
97                 byte[] ret = bindings.SpliceLocked_write(this.ptr);
98                 Reference.reachabilityFence(this);
99                 return ret;
100         }
101
102         /**
103          * Read a SpliceLocked from a byte array, created by SpliceLocked_write
104          */
105         public static Result_SpliceLockedDecodeErrorZ read(byte[] ser) {
106                 long ret = bindings.SpliceLocked_read(ser);
107                 Reference.reachabilityFence(ser);
108                 if (ret >= 0 && ret <= 4096) { return null; }
109                 Result_SpliceLockedDecodeErrorZ ret_hu_conv = Result_SpliceLockedDecodeErrorZ.constr_from_ptr(ret);
110                 return ret_hu_conv;
111         }
112
113 }