1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A splice_locked message to be sent to or received from a peer.
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 {
20 if (ptr != 0) { bindings.SpliceLocked_free(ptr); }
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); };
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); };
46 * Constructs a new SpliceLocked given each field
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); };
59 long ret = bindings.SpliceLocked_clone_ptr(this.ptr);
60 Reference.reachabilityFence(this);
65 * Creates a copy of the SpliceLocked
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); };
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.
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); };
89 @Override public boolean equals(Object o) {
90 if (!(o instanceof SpliceLocked)) return false;
91 return this.eq((SpliceLocked)o);
94 * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read
96 public byte[] write() {
97 byte[] ret = bindings.SpliceLocked_write(this.ptr);
98 Reference.reachabilityFence(this);
103 * Read a SpliceLocked from a byte array, created by SpliceLocked_write
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);