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 * An Err type for failure to process messages.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class LightningError extends CommonBase {
16 LightningError(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.LightningError_free(ptr); }
24 * A human-readable message describing the error
26 public String get_err() {
27 String ret = bindings.LightningError_get_err(this.ptr);
28 Reference.reachabilityFence(this);
33 * A human-readable message describing the error
35 public void set_err(java.lang.String val) {
36 bindings.LightningError_set_err(this.ptr, val);
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * The action which should be taken against the offending peer.
44 public ErrorAction get_action() {
45 long ret = bindings.LightningError_get_action(this.ptr);
46 Reference.reachabilityFence(this);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
49 ret_hu_conv.ptrs_to.add(this);
54 * The action which should be taken against the offending peer.
56 public void set_action(ErrorAction val) {
57 bindings.LightningError_set_action(this.ptr, val.ptr);
58 Reference.reachabilityFence(this);
59 Reference.reachabilityFence(val);
63 * Constructs a new LightningError given each field
65 public static LightningError of(java.lang.String err_arg, ErrorAction action_arg) {
66 long ret = bindings.LightningError_new(err_arg, action_arg.ptr);
67 Reference.reachabilityFence(err_arg);
68 Reference.reachabilityFence(action_arg);
69 if (ret >= 0 && ret <= 4096) { return null; }
70 LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new LightningError(null, ret); }
71 ret_hu_conv.ptrs_to.add(ret_hu_conv);
76 long ret = bindings.LightningError_clone_ptr(this.ptr);
77 Reference.reachabilityFence(this);
82 * Creates a copy of the LightningError
84 public LightningError clone() {
85 long ret = bindings.LightningError_clone(this.ptr);
86 Reference.reachabilityFence(this);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new LightningError(null, ret); }
89 ret_hu_conv.ptrs_to.add(this);