1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * An Err type for failure to process messages.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class LightningError extends CommonBase {
15 LightningError(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.LightningError_free(ptr); }
23 * A human-readable message describing the error
25 public String get_err() {
26 String ret = bindings.LightningError_get_err(this.ptr);
31 * A human-readable message describing the error
33 public void set_err(java.lang.String val) {
34 bindings.LightningError_set_err(this.ptr, val);
38 * The action which should be taken against the offending peer.
40 public ErrorAction get_action() {
41 long ret = bindings.LightningError_get_action(this.ptr);
42 if (ret < 1024) { return null; }
43 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
44 ret_hu_conv.ptrs_to.add(this);
49 * The action which should be taken against the offending peer.
51 public void set_action(ErrorAction val) {
52 bindings.LightningError_set_action(this.ptr, val.ptr);
56 * Constructs a new LightningError given each field
58 public static LightningError of(java.lang.String err_arg, ErrorAction action_arg) {
59 long ret = bindings.LightningError_new(err_arg, action_arg.ptr);
60 if (ret < 1024) { return null; }
61 LightningError ret_hu_conv = new LightningError(null, ret);
62 ret_hu_conv.ptrs_to.add(ret_hu_conv);
67 * Creates a copy of the LightningError
69 public LightningError clone() {
70 long ret = bindings.LightningError_clone(this.ptr);
71 if (ret < 1024) { return null; }
72 LightningError ret_hu_conv = new LightningError(null, ret);
73 ret_hu_conv.ptrs_to.add(this);