X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FLightningError.java;h=9934b4247304f3c5f035851baaaa576dfe01cbd1;hb=ff3dacec3be60f870d81f6df11bd9fff92aa6047;hp=5f7391f67c2686f0ba7a6b141824a8484fe270f3;hpb=3d559f3266fde7c6a21248c10d9a7145125b5e69;p=ldk-java diff --git a/src/main/java/org/ldk/structs/LightningError.java b/src/main/java/org/ldk/structs/LightningError.java index 5f7391f6..9934b424 100644 --- a/src/main/java/org/ldk/structs/LightningError.java +++ b/src/main/java/org/ldk/structs/LightningError.java @@ -2,17 +2,92 @@ package org.ldk.structs; import org.ldk.impl.bindings; import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +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 { - bindings.LightningError_free(ptr); super.finalize(); + super.finalize(); + 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); + Reference.reachabilityFence(this); + return ret; + } + + /** + * A human-readable message describing the error + */ + public void set_err(java.lang.String val) { + bindings.LightningError_set_err(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The action which should be taken against the offending peer. + */ + public ErrorAction get_action() { + long ret = bindings.LightningError_get_action(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.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); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * 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); + Reference.reachabilityFence(err_arg); + Reference.reachabilityFence(action_arg); + 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; + } + + long clone_ptr() { + long ret = bindings.LightningError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the LightningError + */ + public LightningError clone() { + long ret = bindings.LightningError_clone(this.ptr); + Reference.reachabilityFence(this); + 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_err - // Skipped LightningError_set_err - // Skipped LightningError_get_action - // Skipped LightningError_set_action - // Skipped LightningError_new }