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 org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret);
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
54 * The action which should be taken against the offending peer.
56 public void set_action(org.ldk.structs.ErrorAction val) {
57 bindings.LightningError_set_action(this.ptr, val.ptr);
58 Reference.reachabilityFence(this);
59 Reference.reachabilityFence(val);
60 if (this != null) { this.ptrs_to.add(val); };
64 * Constructs a new LightningError given each field
66 public static LightningError of(java.lang.String err_arg, org.ldk.structs.ErrorAction action_arg) {
67 long ret = bindings.LightningError_new(err_arg, action_arg.ptr);
68 Reference.reachabilityFence(err_arg);
69 Reference.reachabilityFence(action_arg);
70 if (ret >= 0 && ret <= 4096) { return null; }
71 org.ldk.structs.LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.LightningError(null, ret); }
72 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(action_arg); };
78 long ret = bindings.LightningError_clone_ptr(this.ptr);
79 Reference.reachabilityFence(this);
84 * Creates a copy of the LightningError
86 public LightningError clone() {
87 long ret = bindings.LightningError_clone(this.ptr);
88 Reference.reachabilityFence(this);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.LightningError(null, ret); }
91 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };