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=be3d75933fe41dab5171dc2ca043854298a3525b;hpb=110f2f104ba8fc34caa7e34e04737f36f064b050;p=ldk-java diff --git a/src/main/java/org/ldk/structs/LightningError.java b/src/main/java/org/ldk/structs/LightningError.java index be3d7593..93785a26 100644 --- a/src/main/java/org/ldk/structs/LightningError.java +++ b/src/main/java/org/ldk/structs/LightningError.java @@ -4,26 +4,74 @@ 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; } - public void set_err(byte[] val) { + /** + * A human-readable message describing the error + */ + public void set_err(java.lang.String val) { bindings.LightningError_set_err(this.ptr, val); } - // Skipped LightningError_get_action - // Skipped LightningError_set_action - // Skipped LightningError_new + /** + * 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; + } + + /** + * 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; + } + }