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 * Invalid inbound onion payment.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class InboundHTLCErr extends CommonBase {
16 InboundHTLCErr(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.InboundHTLCErr_free(ptr); }
26 public short get_err_code() {
27 short ret = bindings.InboundHTLCErr_get_err_code(this.ptr);
28 Reference.reachabilityFence(this);
35 public void set_err_code(short val) {
36 bindings.InboundHTLCErr_set_err_code(this.ptr, val);
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * Data attached to this error.
44 * Returns a copy of the field.
46 public byte[] get_err_data() {
47 byte[] ret = bindings.InboundHTLCErr_get_err_data(this.ptr);
48 Reference.reachabilityFence(this);
53 * Data attached to this error.
55 public void set_err_data(byte[] val) {
56 bindings.InboundHTLCErr_set_err_data(this.ptr, val);
57 Reference.reachabilityFence(this);
58 Reference.reachabilityFence(val);
64 public String get_msg() {
65 String ret = bindings.InboundHTLCErr_get_msg(this.ptr);
66 Reference.reachabilityFence(this);
73 public void set_msg(java.lang.String val) {
74 bindings.InboundHTLCErr_set_msg(this.ptr, val);
75 Reference.reachabilityFence(this);
76 Reference.reachabilityFence(val);
80 * Constructs a new InboundHTLCErr given each field
82 public static InboundHTLCErr of(short err_code_arg, byte[] err_data_arg, java.lang.String msg_arg) {
83 long ret = bindings.InboundHTLCErr_new(err_code_arg, err_data_arg, msg_arg);
84 Reference.reachabilityFence(err_code_arg);
85 Reference.reachabilityFence(err_data_arg);
86 Reference.reachabilityFence(msg_arg);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 org.ldk.structs.InboundHTLCErr ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InboundHTLCErr(null, ret); }
89 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
94 long ret = bindings.InboundHTLCErr_clone_ptr(this.ptr);
95 Reference.reachabilityFence(this);
100 * Creates a copy of the InboundHTLCErr
102 public InboundHTLCErr clone() {
103 long ret = bindings.InboundHTLCErr_clone(this.ptr);
104 Reference.reachabilityFence(this);
105 if (ret >= 0 && ret <= 4096) { return null; }
106 org.ldk.structs.InboundHTLCErr ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InboundHTLCErr(null, ret); }
107 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
112 * Generates a non-cryptographic 64-bit hash of the InboundHTLCErr.
115 long ret = bindings.InboundHTLCErr_hash(this.ptr);
116 Reference.reachabilityFence(this);
120 @Override public int hashCode() {
121 return (int)this.hash();
124 * Checks if two InboundHTLCErrs contain equal inner contents.
125 * This ignores pointers and is_owned flags and looks at the values in fields.
126 * Two objects with NULL inner values will be considered "equal" here.
128 public boolean eq(org.ldk.structs.InboundHTLCErr b) {
129 boolean ret = bindings.InboundHTLCErr_eq(this.ptr, b.ptr);
130 Reference.reachabilityFence(this);
131 Reference.reachabilityFence(b);
132 if (this != null) { this.ptrs_to.add(b); };
136 @Override public boolean equals(Object o) {
137 if (!(o instanceof InboundHTLCErr)) return false;
138 return this.eq((InboundHTLCErr)o);