X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FResult_boolPeerHandleErrorZ.java;h=b409c2f72409abb35317f2f7861e61f76a7548c1;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=e29335b6b91b10b01915b9ae913119637e49e1ca;hpb=aa0e2aade37133339f4113a0cd7465b111f0a0d0;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Result_boolPeerHandleErrorZ.java b/src/main/java/org/ldk/structs/Result_boolPeerHandleErrorZ.java index e29335b6..b409c2f7 100644 --- a/src/main/java/org/ldk/structs/Result_boolPeerHandleErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_boolPeerHandleErrorZ.java @@ -4,8 +4,8 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import javax.annotation.Nullable; -@SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Result_boolPeerHandleErrorZ extends CommonBase { private Result_boolPeerHandleErrorZ(Object _dummy, long ptr) { super(ptr); } protected void finalize() throws Throwable { @@ -13,7 +13,7 @@ public class Result_boolPeerHandleErrorZ extends CommonBase { } static Result_boolPeerHandleErrorZ constr_from_ptr(long ptr) { - if (bindings.LDKCResult_boolPeerHandleErrorZ_result_ok(ptr)) { + if (bindings.CResult_boolPeerHandleErrorZ_is_ok(ptr)) { return new Result_boolPeerHandleErrorZ_OK(null, ptr); } else { return new Result_boolPeerHandleErrorZ_Err(null, ptr); @@ -25,9 +25,6 @@ public class Result_boolPeerHandleErrorZ extends CommonBase { super(_dummy, ptr); this.res = bindings.LDKCResult_boolPeerHandleErrorZ_get_ok(ptr); } - public Result_boolPeerHandleErrorZ_OK(boolean res) { - this(null, bindings.CResult_boolPeerHandleErrorZ_ok(res)); - } } public static final class Result_boolPeerHandleErrorZ_Err extends Result_boolPeerHandleErrorZ { @@ -35,12 +32,54 @@ public class Result_boolPeerHandleErrorZ extends CommonBase { private Result_boolPeerHandleErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.LDKCResult_boolPeerHandleErrorZ_get_err(ptr); - PeerHandleError err_hu_conv = new PeerHandleError(null, err); + PeerHandleError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new PeerHandleError(null, err); } + err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } - public Result_boolPeerHandleErrorZ_Err(PeerHandleError err) { - this(null, bindings.CResult_boolPeerHandleErrorZ_err(err == null ? 0 : err.ptr & ~1)); - this.ptrs_to.add(err); - } } + + /** + * Creates a new CResult_boolPeerHandleErrorZ in the success state. + */ + public static Result_boolPeerHandleErrorZ ok(boolean o) { + long ret = bindings.CResult_boolPeerHandleErrorZ_ok(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_boolPeerHandleErrorZ ret_hu_conv = Result_boolPeerHandleErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_boolPeerHandleErrorZ in the error state. + */ + public static Result_boolPeerHandleErrorZ err(PeerHandleError e) { + long ret = bindings.CResult_boolPeerHandleErrorZ_err(e == null ? 0 : e.ptr & ~1); + if (ret >= 0 && ret <= 4096) { return null; } + Result_boolPeerHandleErrorZ ret_hu_conv = Result_boolPeerHandleErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_boolPeerHandleErrorZ_is_ok(this.ptr); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_boolPeerHandleErrorZ_clone_ptr(this.ptr); + return ret; + } + + /** + * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_boolPeerHandleErrorZ clone() { + long ret = bindings.CResult_boolPeerHandleErrorZ_clone(this.ptr); + if (ret >= 0 && ret <= 4096) { return null; } + Result_boolPeerHandleErrorZ ret_hu_conv = Result_boolPeerHandleErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + }