X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FLightningError.java;h=93785a268249475b1923cd44230cb202e9cc3b9d;hb=c6bac88847b7c09560af81f00ba8dd3c2ebe3a19;hp=6574e77bba607b3006e257b6c382fa8d3957997b;hpb=592c4f92dd3011a2f2a7988ce66ed166c3a8f58c;p=ldk-java diff --git a/src/main/java/org/ldk/structs/LightningError.java b/src/main/java/org/ldk/structs/LightningError.java index 6574e77b..93785a26 100644 --- a/src/main/java/org/ldk/structs/LightningError.java +++ b/src/main/java/org/ldk/structs/LightningError.java @@ -2,22 +2,76 @@ package org.ldk.structs; import org.ldk.impl.bindings; import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + +/** + * An Err type for failure to process messages. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays public class LightningError extends CommonBase { LightningError(Object _dummy, long ptr) { super(ptr); } @Override @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); - bindings.LightningError_free(ptr); + if (ptr != 0) { bindings.LightningError_free(ptr); } + } + + /** + * A human-readable message describing the error + */ + public String get_err() { + String ret = bindings.LightningError_get_err(this.ptr); + return ret; + } + + /** + * A human-readable message describing the error + */ + public void set_err(java.lang.String val) { + bindings.LightningError_set_err(this.ptr, val); + } + + /** + * The action which should be taken against the offending peer. + */ + public ErrorAction get_action() { + long ret = bindings.LightningError_get_action(this.ptr); + if (ret >= 0 && ret <= 4096) { return null; } + ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * The action which should be taken against the offending peer. + */ + public void set_action(ErrorAction val) { + bindings.LightningError_set_action(this.ptr, val.ptr); + } + + /** + * Constructs a new LightningError given each field + */ + public static LightningError of(java.lang.String err_arg, ErrorAction action_arg) { + long ret = bindings.LightningError_new(err_arg, action_arg.ptr); + if (ret >= 0 && ret <= 4096) { return null; } + LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new LightningError(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; } - // Skipped LightningError_get_err - public void set_err(LightningError this_ptr, byte[] val) { - bindings.LightningError_set_err(this_ptr == null ? 0 : this_ptr.ptr & ~1, val); - this.ptrs_to.add(this_ptr); + /** + * Creates a copy of the LightningError + */ + public LightningError clone() { + long ret = bindings.LightningError_clone(this.ptr); + if (ret >= 0 && ret <= 4096) { return null; } + LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new LightningError(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } - // Skipped LightningError_get_action - // Skipped LightningError_set_action - // Skipped LightningError_new }